0
Can anyone explain this to me? This is in java tutorials?
**Remember: do not use semicolons after method and class declarations that follow with the body defined using the curly braces.!** " im assuming that it means if )}; then do );} ??
2 Respostas
+ 1
I suppose this is meant for C and C++ programmers.
A class definition in C++ (and struct is similar in C) looks like:
class name {
public:
string first_name;
string middle_name;
string last_name;
// and the methods and other fields
}; // note the ; at the end here
Contrast that with Java:
class Name {
public String firstName;
public String middleName;
public String lastName;
} // no ; here
0
its just that it was in the java course.
even though ; is not at the very end its still at the end for example
int x;
x = 56;
{if(x > 55)System.out.println("hello");}
<< see
i thought it was missleading as i thought if i used {} for anything i wouldn't have to use ; at the end anywere lol
or maby its just me over analyzing 😀