Question

List the output for the following lines of code (Hint: 4 lines of code should print):...

List the output for the following lines of code (Hint: 4 lines of code should print):

public class MPL3

{

public static void main(String[] args)

{

String s1 = "Java isn't just for breakfast.";

String s2 = "JAVA isn't just for breakfast.";

String s3 = "A cup of java is a joy forever.";

if (s3.compareToIgnoreCase(s1) < 0)

{

System.out.println("\"" + s3 + "\"");

System.out.println("precedes");

System.out.println("\"" + s1 + "\"");

System.out.println("in alphabetic ordering");

}

else

System.out.println("s3 does not precede s1.");

}

}

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
List the output for the following lines of code (Hint: 4 lines of code should print):...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Show the output of running the class Test in the following code lines: interface A {...

    Show the output of running the class Test in the following code lines: interface A { void print (); } class C ( class B extends C implements A { public void print() { } } class Test { public static void main(String[] args) { B b = new B(); if (b instanceof A) System.out.println("b is an instance of A"); w class Test { public static void main(String[] args) { B b = new B(); if (b instanceof A) System.out.println("b...

  • Hello, Can you please error check my javascript? It should do the following: Write a program...

    Hello, Can you please error check my javascript? It should do the following: Write a program that uses a class for storing student data. Build the class using the given information. The data should include the student’s ID number; grades on exams 1, 2, and 3; and average grade. Use appropriate assessor and mutator methods for the grades (new grades should be passed as parameters). Use a mutator method for changing the student ID. Use another method to calculate the...

  • Show the output of running the class Test in the following code lines: a) Nothing. b)...

    Show the output of running the class Test in the following code lines: a) Nothing. b) b is an instance of A followed by b is an instance of c c) b is an instance of C d) b is an instance of A interface A { void print (); } class C {} class B extends c implements A { public void print() { } } class Test { public static void main(String[] args) { B b = new...

  • What will be the output of the following Java code? class Output { public static void...

    What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } } a) 0 b) 1 c) false d) true

  • import java.util.Scanner; public class StudentClient {       public static void main(String[] args)    {   ...

    import java.util.Scanner; public class StudentClient {       public static void main(String[] args)    {        Student s1 = new Student();         Student s2 = new Student("Smith", "123-45-6789", 3.2);         Student s3 = new Student("Jones", "987-65-4321", 3.7);         System.out.println("The name of student #1 is ");         System.out.println("The social security number of student #1 is " + s1.toString());         System.out.println("Student #2 is " + s2);         System.out.println("the name of student #3 is " + s3.getName());         System.out.println("The social security number...

  • Java. What is the output of this code? Ace.java public class Ace { private double a;...

    Java. What is the output of this code? Ace.java public class Ace { private double a; public Ace ( double x) {       a = x; } public void multiply (double f) {       a *= x;         } public String toString () {       return String.format ("%.3f", x); AceDem.java public class AceDemo { public static void main(String args[]) {    Ace card = new Ace (2.133); card.multiply (.5); System.out.println (card); } }

  • Language is Java. Thank you.It is a review test and I will find out the rest...

    Language is Java. Thank you.It is a review test and I will find out the rest if I just know that answers. 1) What is the output of the following code: public class Test public static void main(String] args) [ String s1 new String("Java String s2 new String("Java) System.out.print( (s1 s2)(s1.equals (s2))) A) false false B) true true C) false true D) true false E) None of the above 2) Given the following program: public class Test f public static...

  • What are the first five lines printed from this code and why? public class LoopQ {...

    What are the first five lines printed from this code and why? public class LoopQ { public static void main(String[] args) { for(char c = 'A'; c < 'Z'; c++) { for(int i = 0; i < 2; i++) { System.out.println("seat "+c+i); } } } }

  • In java Problem: Using the ‘Name.java’ and ‘Student.java’ files, expand both classes to include the following...

    In java Problem: Using the ‘Name.java’ and ‘Student.java’ files, expand both classes to include the following methods: A ‘copy’ constructor, A ‘clone’ method, A ‘finalize’ method, A ‘dispose’ method, and A ‘hashCode’ method. A ‘compareTo’ method Test the upgraded classes using the application ‘TestStudentName.java’ located in ‘Chapter01_Files.zip’. Be sure to include output messages in both the ‘finalize’ method and the ‘dispose’ method. Chapter01 File 'TestStudentName.java' below. // ----------------------------------------------- // TestStudentName.java // ----------------------------------------------- public class TestStudentName {    public static void...

  • Fix 15 errors in the code below public class CallingMethodsInSameClass {         string fName = Joe;...

    Fix 15 errors in the code below public class CallingMethodsInSameClass {         string fName = Joe;         string lName = Hasley;         string fullName;         public static void main(String[] args) {                  printOne()                  concatThem()         }         public static void printOne() {                  System.out.println(Hello World)                 public static void concatThem() {         fullName = fName + “ “ + lName;         if(fullName.equals(fName + lName){      system.out.println(“It’s a match! fullName is: “ + fullname”)         }         else        ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT