Problem

What’s the Output?Be very careful. These are diffi cult and a bit tricky.a. public class Q...

What’s the Output?

Be very careful. These are diffi cult and a bit tricky.

a. public class Quine   {     public static void main(String[] args)     {       char c = 34;       System.out.print(s + c + s + c + ' ; ' + '} ');     }     static String s1 = "public class Quine{public static void main(String[] args) ";     static String s2 = "{char c = 34;System.out.print(s + c + s + c + '; ' + '} ');} static String s = ";     static String s = s1 + s2;   }


b. public class LinkMeUp   {      private int data;      private LinkMeUp next;      LinkMeUp(int num)      {          data = num * num; next = null;      }

      LinkMeUp()      {          this(0);      }

      LinkMeUp add(int num)      {          LinkMeUp temp = new LinkMeUp(num);          temp.next = this;          return(temp);      }

      void print()      {          LinkMeUp temp = this;          while (temp ! = null)          {              System.out.println(temp.data);              temp = temp.next;          }      }

      public static void main(String[] args)      {          LinkMeUp link = new LinkMeUp();          for (int k = 1; k<10; k++)               link = link.add(k);          link.print();      }   }

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 10
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