Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following Questions: The required keyboard I/O statements are predefined

ID: 3934207 • Letter: F

Question

For the following Questions: The required keyboard I/O statements are predefined as: import javax.swing. JOptionPane Import java.util.Scanner; Scanner kB = new Scanner You have created a java source program: MyProg.java To compile the program under DOS - Write down the compilation command Suppose there is no syntax error, what will be the file name of the O/P created by the compiler? What is the command you will use to execute the program? ANS (1): ANS (2): ANS (3): Write one console O/P statement in one line without any literals to display the following sentences in 4 lines by using the variable definitions as these: String s1 = "I like Java very much 'n"; String s2 = "Java is powerful, interesting and easy to learn 'n"; String s3 = " I made a commitment to myself that I shall master this technology to matter what, 'n"; String s4 = "I am inspired profoundly by my professor that with this technology in my mind it shall benefit all my life, "n"; Write one GUI O/P statement in one line without any literals to display the following sentences in 4 lines by using the variable definitions as these String s1 = " I like Java very much, n"; String s2 = "Java is powerful, interesting and easy to learn 'n"; String s3 = " I made a commitment to myself that I shall master this technology to matter what, 'n"; String s4 = "I am inspired profoundly by my professor that with this technology in my mind it shall benefit all my life, "n"; Write one console O/P statement without any literals to display the following lines of words using the Strings variables defined below: A variable declared within a method definition is called a local variable. Are these local variable(s) available to other method(s)? ANS: circle Yes or No

Explanation / Answer

1. Ans 1. javac MyProg.java will compile the code.

Ans 2. MyProg.class is the output created by the compiler.

Ans 3. java MyProg will execute the code.

2. System.out.println(s1 + s2 + s3 + s4); will do the needful.

3. JOptionPane.showMessageDialog(null, s1+s2+s3+s4); will do the needful.

4. System.out.println(t1 + t2 + " " + t3 + " " + t4 + " " + t5 + " " + "Final " + t6); Note that we can't achieve this without using any literals.

5. No. The local variables are local to a method, and are not available outside the method.