7. Which of the following things have curly braces?
a) Constructor
b) Declaration
c) Main Method
d) A section of code that is grouped together
e) Class
f) Task
g) While Loop
h) Input Statement
i) Ifs
HELP!.. JAVa?
a
c
d
e
but NOT h %26amp; i because you can have:
while ( ! hell.freezingOver() ) carry.onAsNormal();
if ( ! hell.freezingOver() ) carry.onAsNormal();
Reply:a, c, d, e
Rest of them may have curly braces if there are more lines need to added like in if %26amp; while case. Similar conditions applies to others too. But a,c,d,e are those options where curly braces is must.
Reply:a) constructor() { }
c) public static void main(String args[]) { }
e) pubic class MyClass { }
g) while() { }
Reply:a,c,e,g,i...
Even though ifs and whiles can exist without them. It is good practice to keep the brackets.
a) constructor() { }
c) public static void main(String args[]) { }
e) pubic class MyClass { }
g) while() { }
i)if{ }
Reply:a,c,e,g
Reply:yamum
survey monkey
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment