Anyone here know a little bit of Java programming?
No one is in the computer science section
Which of the following statements contains incorrect syntax? String[] s = {"one", "two", "three"}; int[] i; char[] c = {'a', 'b', 'c'}; double z = new double[5];
D is the only array declared without brackets
B is also that way
isn't it?
arrays are declared: ``` String[] myStringArray = new String[3]; String[] myStringArray = {"1","2","3"}; ```
it's declared but not instantiated
oh....
nothing wrong with the statement in B syntactically
okay cool. hey would you mind looking over some other questions I answered bibby?
I would just try to run these and see if they work or not, it's probably faster and better for you
ACTUALLY YES I WOULD MIND
Oh ok
I agree with kai, find an online java compiler tag me in your future questions though, I don't mind
lol :P
yea I'm gunna use my eclipse compiler to see if it works
You were right D doesn't work in the compiler. I also checked the other 3
I like this one http://www.tutorialspoint.com/compile_java_online.php http://puu.sh/eRcHP.png
I answered all of them but could you look them over @bibby
I don't need direct answers. just a simple "that one is wrong that one is wrong" would suffice
not sure about 1,sorry. 6,7 so far are wrong the rest seem alright as far as I can tell
okay I'll look em over. thanks :)
For 6 it's got to be x.size(); then right cuase I don't think it would be without the "()" would it?
give me a second to try it out actually
okay
hmm 7 must be backwards then so it must be (double g : z) System.out.println(g);
yeah 7, was backwards. we want every double in the array z ``` for(type element:container) ``` 6, arrays have an attribute called length. x.length is what you want
by element I meant a local identifier
huh okay that makes sense I guess.
lets see how well I did with the fabulous assistance of Bibbity
9/10
which one was wrong?
:) pretty good lol crap I accidentally selected the wrong bubble on number 7 and didn't notice my mistake
tsk tsk tsk
so sad I know lol. it's okay though.
As long as I understand what is going on I'm not too worried about getting a perfect score
you still bring a great shame on our family
D:
I shall take this wrong to the teacher and fight for my right to fix my shameful action
good on you. now go write some fun little programs to get the syntax ingrained in you. later dude
Join our real-time social learning platform and learn together with your friends!