can anyone tell me why in this case the execution of the program gives me an error?
problem level 2 less 2
Under discussion
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
zimme
8 July 2020, 13:40
By task, you only need to declare the variables and not initialize them. So delete those 4 lines (p1.name, p1.age ...)
Everything else is ok as Thomas said, delete exercize
0
Massimo Lorenzi
8 July 2020, 05:07
exercize
package it.codegym.task.task02.task0202;
/*
Where does a Person come from?
*/
public class Solution {
public static void main(String[] args) {
Person p1 = new Person();
p1.name = "Luca";
p1.age = 30;
p1.weight = 60;
p1.money = 300;
}
public static class Person {
String name;
int age;
int weight;
int money;
}
}
0
Thomas
8 July 2020, 11:48
if you have the first line in your code (exercize) then delete it. Despite that I didn't see any problem. Even when copying (from public class Solution on) and compiling it all was smooth.
0