JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This is the main class Question
public class Question23{
public static void main(String[] args) {
// Object of the main class is created
Question23 q = new Question23();
// Print method on object of Question class is called
q.studentMethod();
}
// 'print()' method is defined in class Question
void print(Question23 object){
System.out.print("Well Done!");
}
// Define a method named 'studentMethod()' in class Question
// Call the method named 'print()' in class Question
class Question{
studentMethod(print){
return();
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run