Source Code
import java.util.Scanner;
//=====================================================================================================================
class star{
public void star(){
for(int i=1;i<=50;i++){
System.out.print("*");
}
}
}
class OrGate extends star{
int or1,or2;
...
Source Code
import java.util.Scanner;
class InterChangeNo{
public void swap(){
int a, b;
System.out.println("Enter the value of a and b:");
Scanner in = new Scanner(System.in);
a = in.nextInt();
b = in.nextInt();
System.out.println("Before Swapping\nx =...
Source Code
import java.util.Scanner;
class InterchangeNo{
public void swap(){
int x, y, temp;
System.out.println("Enter any two numbers for swaping them:");
Scanner in = new Scanner(System.in);
x = in.nextInt();
y = in.nextInt();
System.out.println("Before Swapping it was\nx = "+x+"\ny...
Source Code
import java.util.Scanner;
class ReverseString{
public void stringReverse(){
String original, reverse = "";
Scanner in = new Scanner(System.in);
System.out.println("Enter a string to reverse");
original = in.nextLine();
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
...
Source Code
import java.util.Scanner;
class ReverseString{
public void stringReverse(){
System.out.println("Enter string to reverse:");
Scanner read = new Scanner(System.in);
String str = read.nextLine();
StringBuilder sb = new StringBuilder();
...
Source Code
import java.util.Scanner;
class FactorialRecursion{
public void fact(){
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the number:");
int num = scanner.nextInt();
int factorial = fact(num);
System.out.println("Factorial of entered number is: "+factorial);
}
static int...
Source code
import java.util.Scanner;
class FactorialProgram
{
public void fact ()
{
int i, fact = 1;
Scanner Sc = new Scanner (System.in);
System.out.println ("Enter any number to find it's Factorial");
int number = Sc.nextInt ();
for (i = 1; i <= number; i++)
{
fact = fact * i;
}
System.out.println ("Factorial of " + number + " is: " + fact);
}
}
class...
Source Code
class MyPro{ public void print(){ int[ ] primes = {2, 3, 5, 7}; for (int t: primes) { System.out.println(t); } }}public class Program...
Source Code
public class Program
{
public static void main(String[] args) {
int h,i,j,k;
for(h=1;h<=10;h++)// For First Rows (Horizontal line)
System.out.print("*");
for(i=1;i<=10;i++) // For Column (Vertical line)
System.out.println("*");
for(j=1;j<=i;j++) // for 3rd line(rows)
System.out.print("*");
...
Source Code
public class Program //you can give any name to "class"
{
public static void main(String[] args) {
System.out.println("Hello! java");
// Note you have to write "S" capital in "System"
System.out.println("This is my First Program In Java");
}
}
Output...
Java Programming Language
Java is,
A high-Level Programming Language
A general-purpose Object-Oriented Language (Based on the concepts of "Objects") called OOP(Object-oriented Programming)
It is designed for Web/internet applications.
The name "Java" is basically derived from the Island of Indonesia Java and the people of Javanese speaks the Javanese language, which is a natural language.
Java is a platform independent language,...
Subscribe
For New Post Notifications