0
Whst did I do wrong?
4 Réponses
+ 3
/*You have written class name two times in the top of the code
Try this one
*/
public class Person{
int age;
String color;
String series;
String game;
void hinkeln(){
System.out.println("hinkel honkel");
}
public static void main(String[] args) {
Person max = new Person();
max.color = "schwarz";
max.game = "cool game";
max.series = "cool series";
max.hinkeln();
}
}
+ 3
Max
Yes. In this form:
public class Person{
int age;
String color;
String series;
String game;
void hinkeln(){
System.out.println("hinkel honkel");
}
}
public class Program{
public static void main(String[] args) {
Person max = new Person();
max.color = "schwarz";
max.game = "cool game";
max.series = "cool series";
max.hinkeln();
}
}
Person is a class and Program is your main class.
+ 1
Denise Roßberg didn't think of that. This is smart, thanks 👌🤝
0
Thanks now i get it somehow. i have one question though: Do you need to close "public class Person" (!)at the end(!) to make that class acessable for the main class?