Can you fix this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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) { } }

29th Nov 2021, 3:10 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
5 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...!!!
29th Nov 2021, 3:28 PM
Jayakrishna 🇮🇳
0
Plsss
29th Nov 2021, 3:22 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
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) ;
29th Nov 2021, 3:23 PM
Jayakrishna 🇮🇳
0
I change it to java
29th Nov 2021, 3:24 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
Can you change it to jav
29th Nov 2021, 3:24 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar