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

Using Java, answer the following Write 1 Java console (DOS) O/P statement using

ID: 3809761 • Letter: U

Question

Using Java, answer the following

Write 1 Java console (DOS) O/P statement using the variable definitions only as stated below that will cause the following to be written to the screen and display in three lines. The last 2 lines should be displayed in 1 line. String s1 = "Once upon a time, "; String s2 = "there were three student programmers discussing how to learn java effectively."; String s3 = "One student said that"; String s4 = "all we need to do is practicing write programs, compile and run it.";

Explanation / Answer

StringDemo.java

public class StringDemo {

   public static void main(String[] args) {
       //Declaring variables
       String s1="Once upon a time, ";
       String s2="there were three student programmers discussing how to learn java effectively .";
       String s3="One student said that ";
       String s4="all we need to do is practicing write programs, compile and run it.";
      
       //Displaying the output.
       System.out.println(s1);
       System.out.println(s2);
       System.out.println(s3+s4);
      
      

   }

}

____________________

Output:

Once upon a time,
there were three student programmers discussing how to learn java effectively .
One student said that all we need to do is practicing write programs, compile and run it

_____________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote