+ 1
Can you fix this
class Actor} string name, nationality; char gender; int age; public: Human(): name("John"), nationality("German"), gender('M'), age(25){} void display(){ cout<<"Name: "<<name<<endl; cout<<"Nationality: "<<nationality<<endl; cout<<"Gender: "<<gender<<endl; cout<<"Age: "<<age<<endl; } }; int main(){ Human person; person.display(); return 0; } { public static void main(String[] args) { } }
6 Answers
+ 1
I can but sorry, you need to try first. You completed java course 100% then it should be a couple of minutes to do it.
You must post your try.. I posted some of how to do it...!!!
0
Plsss
0
Is that a c++ code, need in java?
Oh..
You must try first :
Class syntax in java, generally (simplified form) :
class Name {
//add data fields here
//next add constructera and methods here, ( this may contain main method also , if it is main class)
}
For printing
System.out.println("Name: "+name) ;
0
I change it to java
0
Can you change it to jav