Friday, June 1, 2018

Technical Tip #14 - Technical Tip of the day....by JavaExpertHelp – www.JavaByKiran.com

T14: Knowledge Tip Of The Day...
instanceof operator
instanceof operator is used to check the type of an object at runtime. It is the means by which your program can obtain run-time type information about an object. instanceof operator is also important in case of casting object at runtime. instanceof operator return boolean value, if an object reference is of specified type then it return true otherwise false.
example of instanceof operator ::
class Parent{ }
class Child1 extends Parent{ }
class Child2 extends Parent{ }
class Test
{
public static void main(String[] args)
{
Parent p =new Parent();
Child1 c1 = new Child1();
Child2 c2 = new Child2();
System.out.println(c1 instanceof Parent); //true
System.out.println(c2 instanceof Parent); //true
System.out.println(p instanceof Child1); //false
System.out.println(p instanceof Child2); //false
p = c1;
System.out.println(p instanceof Child1); //true
System.out.println(p instanceof Child2); //false
p = c2;
System.out.println(p instanceof Child1); //false
System.out.println(p instanceof Child2); //true
}
}
https://www.javabykiran.com




Regards,
javabykiranhr1@gmail.com
#Java #Learn #Upgrade #Training #Classes #OnlineLecture #OnlineVideos #Pune
Follow On LinkedIn @ https://bit.ly/2J2MbvU   
Join Our Google Group @ https://bit.ly/2sjbIuq  
#Call Now to book your seat to JOIN Java Training @ 7219474925, eMail @ javabykiranhr1@gmail.com
#Visit us @ www.JavaByKiran.com
#Java #J2EE
#Core +#Advance + #Struts +#Hibernate + #Spring + #REST + #OCJP + #OCWCD + #Maven + #Junit + #Jquery #Ajax + #XML
#Spring Boot + CI and many more ..
#Selenium
#Complete #Java + #Selenium + #TestNg + #Jenkin + #Webdriver + #Cucumber +#Maven + #DataProvider + #Keyword + #Hybrid + #POM End to End integration #Jenkin #Maven #Testng and many more ..
#JavabyKiran #Expert #Training #BestInstitute #Java #Python #Selenium #Freshers #Professionals #IT #Software #Career #Interview #Jobs#Jobopening  #BestTrainingInstituteinPune #ITCourses  #OnlineVideo  #Pune

No comments:

Post a Comment