This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
String phrase=wordListOne[rand1]+" "+wordListTwo[rand2]+" "+wordListThree[rand3];
System.out.println("What we need is a "+phrase);
This program is 100% error-free and will give correct output...
Aman Kulkarni wrote: . . . This program is 100% error-free and will give correct output...
100% error-free: that is a red rag to a bull indeed!
1: incorrect indentation, using tabs rather than spaces.
2: Incorrect formatting, not using space after comma.
3: Incorrect typing, using  after args rather than before it.
4: Poor formatting: no spaces adjacent to binary operators.
6: PhraseOMatic misspelt in name of class.
6: Compiler error: dangling quote at the end of a line. That is obscured because you didn’t use the code button.
7: Similar error where a String literal is split over two lines.
8: additional new lines where they are not required, and lines crammed together as a block where new lines would have been useful.
9: Lines too long.
Never have the arrogance to say you are 100% error-free. I got 58 compiler errors when I copied and pasted your code.
Joined: Oct 13, 2005
Please continue any discussion here; I am closing this thread as a duplicate of it.
Joined: Jan 21, 2012
I used the same program and it executed without any hassles...I accept the class name and the indentation mistake....and the String args is the way we were taught java...it may be considered as my ignorance but not arrogance