Ticker

6/recent/ticker-posts

JAVA week 2 Program question 3


// 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

void studentMethod()
{

// Call the method named 'print()' in class Question
    Question23 x=new Question23();
    print(x);
}
}

Post a Comment

0 Comments