tag:blogger.com,1999:blog-9193160645817040317.post4538069010669823439..comments2015-12-22T12:31:53.234+05:30Comments on Twisters - The New Age Java Quiz: Puzzle 32 – Double TroubleSaifuddin Merchanthttp://www.blogger.com/profile/09008041357659535766noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-9193160645817040317.post-69879956965425866482009-06-14T04:41:56.891+05:302009-06-14T04:41:56.891+05:30Was thinking on more solutions but cudnt spare muc...Was thinking on more solutions but cudnt spare much time... leaving this one before sleeping as after that the time will b over ;D<br /><br />class DoubleTrouble {<br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br />}<br /><br />public class Trouble {<br /> public static void main(String args[])<br /> {System.out.println("This is the right one!");}<br />}Anonymoushttps://www.blogger.com/profile/02555336332548095243noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-8565040752210886962009-06-13T18:38:09.822+05:302009-06-13T18:38:09.822+05:30Wrap first main method into innner class.Wrap first main method into innner class.TheMalkolmhttps://www.blogger.com/profile/11358745568436186926noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-681541184046214032009-06-12T14:26:51.795+05:302009-06-12T14:26:51.795+05:30package com.twisters;
public class DoubleTrouble{...package com.twisters;<br /><br />public class DoubleTrouble{<br /> <br /> static class Inner {<br /><br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /><br /> }<br /><br /> public static void main(String args[])<br /> {System.out.println("This is the right one!");}<br /><br />}Sebastianhttp://www.yworks.comnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-66983355437324708162009-06-12T14:25:11.115+05:302009-06-12T14:25:11.115+05:30package com.twisters;
class DoubleTrouble{
p...package com.twisters;<br /><br />class DoubleTrouble{<br /><br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /><br /><br /> public static void main(java.lang.String args[])<br /> {System.out.println("This is the right one!");}<br /><br /> class String{}<br />}Sebastianhttp://www.yworks.comnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-11082659805629487452009-06-12T02:21:43.069+05:302009-06-12T02:21:43.069+05:30package com.twisters;
class DoubleTrouble{
pub...package com.twisters;<br />class DoubleTrouble{<br /><br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /> <br /> static <br /> {<br /> System.out.println("This is the right one!");<br /> System.exit(0);}<br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-39781402892651010362009-06-12T00:20:01.756+05:302009-06-12T00:20:01.756+05:30Hi,
This looks pretty cool. Put the main() having...Hi,<br /><br />This looks pretty cool. Put the main() having "Wrong one" in an inner class like below<br /><br />package com.twisters;<br />class DoubleTrouble<br />{<br />static class ragha{<br />public static void main(String args[])<br />{System.out.println("This is the wrong one!");}<br />}<br />public static void main(String args[])<br />{System.out.println("This is the right one!");}<br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-46134310075588160422009-06-11T20:57:30.168+05:302009-06-11T20:57:30.168+05:30package com.twisters;
class DoubleTrouble{
public...package com.twisters;<br />class DoubleTrouble{<br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /> <br /> public static void main(java.lang.String args[])<br /> {System.out.println("This is the right one!");}<br />}<br /><br />class String{}<br /><br />The main principle here is to fool the program in order for it to believe the "wrong" main is not truly the original main method.Anonymoushttps://www.blogger.com/profile/06187177872270364018noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-78414794131131586262009-06-11T20:45:24.884+05:302009-06-11T20:45:24.884+05:30public class DoubleTrouble {
static class Test...public class DoubleTrouble {<br /> static class Test {<br /> public static void main(String args[]) {<br /> System.out.println("This is the wrong one!");<br /> }<br /> }<br /><br /> public static void main(String args[]) {<br /> System.out.println("This is the right one!");<br /> }<br /><br />}Makkhdynhttps://www.blogger.com/profile/16225036210991551541noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-42263797563289087262009-06-11T14:38:25.380+05:302009-06-11T14:38:25.380+05:30package com.twisters;
class DoubleTrouble {
...package com.twisters;<br /><br />class DoubleTrouble {<br /><br /> static class Inner {<br /> public static void main(String args[]) {<br /> System.out.println("This is the wrong one!");<br /> }<br /> }<br /><br /><br /> public static void main(String args[]) {<br /> System.out.println("This is the right one!");<br /> }<br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-17899236734046174832009-06-11T13:58:32.760+05:302009-06-11T13:58:32.760+05:30class DoubleTrouble {
public static void main(...class DoubleTrouble {<br /> public static void main(String args[]) {<br /> System.out.println("This is the wrong one!");<br /> }<br /> public static void main(String args[][]) {<br /> System.out.println("This is the right one!");<br /> }<br />}Anonymoushttps://www.blogger.com/profile/14524513849550206171noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-14289388621580209442009-06-11T12:22:29.648+05:302009-06-11T12:22:29.648+05:30class DoubleTrouble{
static class DoubleTrouble1...class DoubleTrouble{<br /> static class DoubleTrouble1{<br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /> }<br /> public static void main(String args[])<br /> {System.out.println("This is the right one!");}<br /><br /><br />}Ravi Sankarhttps://www.blogger.com/profile/15846738990887406090noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-63196452433232368452009-06-11T00:49:48.869+05:302009-06-11T00:49:48.869+05:30package com.twisters;
class String{}
class Doubl...package com.twisters;<br /><br />class String{}<br /><br />class DoubleTrouble{<br />public static void main(String args[])<br />{System.out.println("This is the wrong one!");}<br />public static void main(java.lang.String args[])<br />{System.out.println("This is the right one!");}<br />}Fred Hsuhttps://www.blogger.com/profile/01605944565710444887noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-61628544886158371952009-06-10T23:07:02.304+05:302009-06-10T23:07:02.304+05:30class DoubleTrouble {
public static class Inn...class DoubleTrouble {<br /><br /> public static class InnerClass {<br /><br /> public static void main(String args[]) {<br /> System.out.println("This is the wrong one!");<br /> }<br /> }<br /><br /> public static void main(String args[]) {<br /> System.out.println("This is the right one!");<br /> }<br />}stfnhttps://www.blogger.com/profile/13802280639197311708noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-89408384887577013232009-06-10T21:57:45.124+05:302009-06-10T21:57:45.124+05:30Here is my solution:
class String {}
class Doub...Here is my solution:<br /><br />class String {}<br /><br /><br />class DoubleTrouble{<br /> public static void main(String args[])<br /> {System.out.println("This is the wrong one!");}<br /> <br /> public static void main(java.lang.String args[])<br /> {System.out.println("This is the right one!");}<br />}<br /><br />By creating a String class, both the String args[] are referring to my String class. To get it to print the proper answer I used a full class name so the proper main() would be called.Joe Smithnoreply@blogger.com