package com.codegym.task.task05.task0514;
/*
A programmer creates a person
*/
public class Solution {
public static void main(String[] args) {
Person person = new Person();
person.initialize("Peter", 17);
}
static class Person {
String name;
int age;
}
public void intialize(String name, int age) {
this.name = name;
this.age = age;
}
}
Compiler mistake
Under discussion
Comments (8)
- Popular
- New
- Old
You must be signed in to leave a comment
Mateusz
9 September 2020, 07:27
First of all, there's a typo in "initialize" ;)
Secondly the initialize method should be in the Person class
+1
Laura
9 September 2020, 14:49
Thank u, that helped me! :)
0
Mateusz
9 September 2020, 15:53
I'm glad :)
BTW Lübeck is such a lovely city!
0
Laura
9 September 2020, 18:28
Unfortunately I still have one more problem :D maybe u can solve this with me too.
wow, do u know Lübeck? That's amazing!
And here is my recently code if u need it:
![]()




0
Misiu
9 September 2020, 18:57
The method name should be: initialize (in-i-tialize)
0
Misiu
8 September 2020, 17:57
Move } from line 17 to line 21.
Check method name in line 18.
+1
Laura
8 September 2020, 19:06
Mmm, so should I remove the "void", too?
0
Misiu
8 September 2020, 19:09
No. This is not a constructor.
0