Top 5 Java Programs

    public class HelloWorld { public static void main(String[] args) { System.out.println(“Hello World!”); } } Output: Hello World!

    public class JavaSwap { public static void main(String[] args) { int a=10, b=20, temp; System.out.println(“Before swapping”); System.out.println(“value of a=”+a); System.out.println(“value […]

    import java.util.Scanner; public class GreatestNumber { public static void main(String[] args) { int n1, n2, n3; Scanner sc = new […]

    import java.util.Scanner; public class VowelsCharacter { public static void main(String[] args) { char ch; Scanner sc=new Scanner(System.in); System.out.print(“Enter Character=”); ch=sc.next().charAt(0); […]

    Factorial is the product of all positive integers less than or equal to n. Examples: 4! = 4 × 3 […]