import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        
    // System.out.println("Hello world!");
    
    // ***********************************    
        
        // The Sum of Number When Multiplied is 
        // String a = "22nd";
        // String b = "April";
        // int c = 2023;
        
        // System.out.println("Today's Date is: ");
        // System.out.print (a + "-" + b + "-" + c);
    
    // ***********************************
    
    /*  Date: 21st April'2023
        Assignment: 9/9
        
        ---------------
    
    Q1> Print the following text:
    
        Ans: Hello 40
             50 World !
            
    Solution below
    
        String a = Hello 40'
        String b = 50 World !
    
        System.out.println(a);
        System.out.print(b);
        
        or
        
        String a = "Hello";
        String d = " World !";
        int b = 40;
        int c = 50;
      
        System.out.println(a + " " + b);
        System.out.print(c + " " + d);
        
        ---------------
        
    Q2> Print the following text in the output:
    
        Ans: Hello

             World !
    
    Solution below
    
        System.out.println("Hello");
        System.out.println("");
        System.out.print("World !");
        
        or
        
        String a = "Hello";
        String S = "";
        String W = "World !";
        
        System.out.println(a);
        System.out.println(S);
        System.out.print(W);
        
        ---------------
    
    Q3  Print the text

    Ans Hello
        World !
        
    Solution below
    
        System.out.println("Hello");
        System.out.print("World !");
        
    ---------------
    
    Q4  Print the following pattern in output
        
    Ans **********
        *        *
        *        *
        **********
        
    Solution below
    
        System.out.println("**********");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("**********");
        
    ---------------
    
    Q5  Print the following pattern in output
        NOTE:    
        [Print the following pattern in 3 lines, in which first and 
        last line has 1 spaces and then 1 star, 
        and middle line has 1 star 1 space and 1 star.]
        
    Ans  *
        * *
         *
         
    Solution below
    
        
    ---------------
    
    Q6  Which of the following options is correct to declare int variables and use it ?
    
    Ans a) int a ; System.out.print(a);
        b) int a = 10; System.out.print(a);
        c) Int a =20; System.out.print(a);
        d) None of the above are correct
        
    Solution below  
    
    Correct Answer: 
        b) int a = 10; System.out.print(a);
        
    --------------- 
    
    Q7  Which of the following options will give you the following output?

    Ans Output: 1020
        
        a) System.out.println(10 + 20);
        b) system.out.println(1020);
        c) System.out.println(1020);
        d) None of the above

    
    Solution below
    
        b) System.out.println(1020);
        
    ---------------
    
    Q8  What will be the output of the following code ?

    Ans int g = 9;
        System.out.print(g * 3);
        
        a) g * 3
        b) 9 * 3
        c) 93
        d) 27
        
    Solutoin below
    
        d) 27
        
    ---------------
    
    Q9  Every statement in JAVA language should end with?
    
    Ans a) Dot or Period [ . ]
        b) Comma [ , ]
        c) Semi-colon [ ; ]
        d) Colon [ : ]
        
    Solution below
    
        c) Semi-colon [ ; ]
        
    
    ---------------
    */
    
    
    // ***********************************
    
    
    /*  Date: 21st April'2023
        Assignment: 7/7
    
    ---------------
    
    Q1> Print first five multiples of 3 that is :
    
        Ans 3 6 9 12 15  
       
    Solution below
    
        int a = 3;
        int b = a+3;
        int c = b+3; 
        int d = c+3;
        int e = d+3;

        System.out.print (a + " " + b + " " + c + " " + d + " " + e);
    
    ---------------
    
    Q2> Print first five multiples of 3 that is :
    
        Ans 3 6 9 12 15
    
    
    
    // ***********************************
    
    Q3>  Print first five multiples of 3 in the following manner
    
       Ans  3*1 = 3
            3*2 = 6
            3*3 = 9
            3*4 = 12
            3*5 = 15
            
    
    --- Solution below
        
            int n = 3;
            int n1 = n*1;
            int n2 = n*2;
            int n3 = n*3;
            int n4 = n*4;
            int n5 = n*5;

            System.out.println("3*1 = " + n1);
            System.out.println("3*2 = " + n2);
            System.out.println("3*3 = " + n3);
            System.out.println("3*4 = " + n4);
            System.out.println("3*5 = " + n5);
    
    Q4  What is the correct output ?

    Ans int a = 5 + 5 * 2 + 2 * 2 + (2 * 3);
    
        System.out.println(a);
        
    Solution below
        = 5 + (5*2 = 10) + (2*2 = 4) + (2*3 = 6)
        = 5 + 10 + 4 + 6 = 25
        
    ---------------
    
    Q5  What is the correct output ?
    
    Ans int x = 10;
        System.out.print(x+1);
        System.out.print(x);
    
    Solution below 
        
    */
    int x = 10;
        System.out.print(x+1);
        System.out.print(x);
    
        
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: