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(); } }
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.