Java Program to Get the Class Name Using the Object of the Class

You are currently viewing Java Program to Get the Class Name Using the Object of the Class

Java program to get the class name using the object of the class

// Java program to get the class name 
// using the object of the class

public class Main {
  public static void main(String[] args) {
    Main m = new Main();
    System.out.println(m.getClass());
  }
}

Output

class Main

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply