Skip to main content

Posts

Showing posts with the label Java Instanceof keyword Hackerrank Solution

Java Instanceof keyword Hackerrank Solution

  Java Instanceof keyword For Explanation Watch Video: Sample Input 5 Student Student Rockstar Student Hacker Sample Output 3 1 1 Note: Run in java 7 Version import  java.util.*; class  Student{} class  Rockstar{   } class  Hacker{} public   class  InstanceOFTutorial{          static  String count(ArrayList mylist){        int  a =  0 ,b =  0 ,c =  0 ;        for ( int  i =  0 ; i < mylist.size(); i++){          Object element=mylist.get(i);           if (element  instanceof  Student)             a++;           if (element  instanceof  Rockst...