Online Java Compiler By
JavaTpoint.com
//import statements import java.lang.*; public class ClassisPrimitiveExample2 { public static void main(String[] args) { ClassisPrimitiveExample2 obj = new ClassisPrimitiveExample2(); Class Class1 = obj.getClass(); int val = 5; Class valClass = int.class; boolean val1 = Class1.isPrimitive(); System.out.println("obj is primitive type? = " + val1); boolean val2 = valClass.isPrimitive(); System.out.println("k is primitive type? = " + val2); } }
Output