computing","strategy","mindshare","portal","space","vision","paradigm","mission"};
int oneLength=wordListOne.length;
int twoLength=wordListTwo.length;
int threeLength=wordListThree.length;
int rand1=(int)(Math.random()*oneLength);
int rand2=(int)(Math.random()*twoLength);
int rand3=(int)(Math.random()*threeLength);
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.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
4
posted
0
Please continue any discussion here; I am closing this thread as a duplicate of it.
Aman Kulkarni
Greenhorn
Joined: Jan 21, 2012
Posts: 15
posted
0
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