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
Share on:

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

Leave a Comment