To call print() method of class Question by creating a method named ‘studentMethod()
public class Question{
public static void main(String[] args) {
Question q = new Question();
q.studentMethod();
}
void print(Question object){
System.out.print("Well Done!");
}
void studentMethod()
{
Question q1=new Question();
print(q1);
}
}
No comments:
Post a Comment