I cannot find an answer online so i need help, i was wondering if
Class class{ *insert code here*}
is considered a statement and also at the start of the curly braces to the last, is that considered a block?.
Asked
Active
Viewed 126 times
-1

TheSilence17
- 183
- 1
- 2
- 9
-
2no, it's considered a class (well, if you replace Class by class, and class by something that is allowed as class name) – Stultuske Feb 29 '16 at 12:20
-
it's considered a class. – P S M Feb 29 '16 at 12:22
-
thanks so much for replying, what about inbetween the braces? would that be called a block? because i know control structures ARE considered as statements and blocks – TheSilence17 Feb 29 '16 at 12:23
-
Your keyword class is vital part – Ajay Pandya Feb 29 '16 at 12:42
-
yes im sorry i realize class needed to be a name of a class and not the keyword and "Class" needed to be "class". – TheSilence17 Feb 29 '16 at 12:43
2 Answers
1
first curly braces are always contain body of class. if you want to declare blocks inside class then again create curly braces in your class.

Musaddique S
- 1,539
- 2
- 15
- 36
-
so it is not considered a block if its for the class, but if i use another pair of curly braces inside it would be? – TheSilence17 Feb 29 '16 at 12:25
-
yes. another pair will be your block that will call at the time of object creation. – Musaddique S Feb 29 '16 at 12:27
-
-
boss. it's a method. if you are asking about main method why don't you ask about other method. method are function with method body inside braces. – Musaddique S Feb 29 '16 at 13:56
0
since java is a case-sensitive so there is no any Class
keyword
class MyTestClass{}
would be java class, not statement.
you could say System.out.println(0);
is statement and if(something==somethings){}
is the if block but these both must be inside java class

Mohsin AR
- 2,998
- 2
- 24
- 36
-
1
-
-
i only have a 11 rep, i need 15 to vote up. And what about the main method? can those curly braces be considered a block and a statement? – TheSilence17 Feb 29 '16 at 12:41
-
-
i do understand the difference before the curly braces, the actual line of code for the main method... what is that called? a statement? a method invocation? both? – TheSilence17 Mar 01 '16 at 08:31