I am trying to create a basic method to check the whether a person is "Adult" or "Minor". I created two classes viz., Lessons.java (main class) and method.java (method class). When I run the program, I get following result:
"run:
Enter the age: 12
lessons.method@55f96302BUILD SUCCESSFUL (total time: 3 seconds)"
What is lessons.method@55f96302 ??? And how to resolve it??
My codes are:
Lessons.java (main class)
package lessons;
import java.util.Scanner;
public class Lessons {
public static void main(String[] args) {
method b = new method();
Scanner input=new Scanner(System.in);
System.out.print ("Enter the age: ");
int age=input.nextInt();
b.simplemessage(age);
System.out.print(b);
}
}
method.java (method class)
package lessons;
public class method {
public String simplemessage(int age){
if (age >= 18)
return "Adult";
else
return "Minor";
}
}
Any helps??