java.lang.Class.isPrimitive()


java.lang.Class.isPrimitive()

package com.codingdict;



import java.lang.*;



public class ClassDemo {



   public static void main(String[] args) {



      // returns the Class object associated with this class

      ClassDemo cl = new ClassDemo();

      Class c1Class = cl.getClass();



      // returns the Class object associated with an integer

      int k = 5;

      Class kClass = int.class;



      // checking for primitive type

      boolean retval1 = c1Class.isPrimitive();

      System.out.println("c1 is primitive type? = " + retval1);



      // checking for primitive type?

      boolean retval2 = kClass.isPrimitive();

      System.out.println("k is primitive type? = " + retval2);

   }

}