package com.codegym.task.task02.task0202;
/*
Where does a Person come from?
*/
public class Solution
{
public static void main(String[] args)
{
//write your code here
}
public static class Person
{
String person= new person();
int age;
int money;
int weight;
String name;//write your code here
}
}
Help me out
Under discussion
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Keval V. Vaghela
9 September 2018, 07:09
As it is mentioned in the requirements section you have to use the following syntax (to create an object and assign memory to that object using constructor):-
VariableType variableName = new TypeofObjectBeingCreated();
i.e. Person person = new Person();
where, TypeofObjectCreated(); = Person(); is a Constructor
and new operator assigns memory to the newly created object "person".
+1
shovan
9 September 2018, 04:47
you have to write Person person = new Person();
inside the p.s.v.main method.
+1
Zeeshan Abbasi
8 September 2018, 21:16useful
String person = new person() , is wrong.
Use the proper variable type.
Person person = new Person();
secondly, this statement is written in main method, don't write it in the class Person.
+1