upcasting vs downcasting in java

Upcasting is casting a subtype to a supertype, 
going up in the inheritance tree.
It is done implicitly
 in order to use method available on any
 interface/class, the object should be of
 same class or of class implementing the interface.  
   WebDriver driver = new ChromeDriver();
or
	TakeScreenShot ts = new ChromeDriver();

3
1
Rick c 90 points

                                    Upcasting is casting a subtype to a supertype, 
going up in the inheritance tree.
It is done implicitly
 in order to use method available on any
 interface/class, the object should be of
 same class or of class implementing the interface.  
   WebDriver driver = new ChromeDriver();
or
	TakeScreenShot ts = new ChromeDriver();
  
Downcasting is casting to a subtype, 
going down in the inheritance tree.
It is done to access sub class features.
It has to be done manually

(TakeScreenShot)driver).takeScreenShot();
  
 

3 (1 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
upcasting and down casting in java java upcast downcasting and upcasting in java upcasthing and downcasthing in java why we use upcasting in java force upcasting in java why upcasting in java what is java upcasting use of upcasting in java upcasting y downcasting java upcasting downcasting examples inn java upcasting downcasting java upcasting example in java java manual upcasting upcast java java upcasting and downcasting explained what is downcasting and upcasting in java upcasting and downcasting in java difference upcasting in java defination upcasting syntax in java java upcasting example upcasting subcasting java upcast java example upcasting and downcasting java can you upcast in java downcasting vs upcasting java java why to do upcasting upcasting downcasting in java why do we need to upcast in java upcast and downcast in java upcasting java example upcasting e downcasting java java upcasting and downcasting downcasting upcasting java why would you upcast in java upcasting what is that java downcasting vs upcasting what is upcasting & Downcasting in java java upcasting from object upcasting and downcasting in java javatpoint class upcasting downcasting java upcasting downcasting example downcasting and upcasting upcasting in java upcasting Does java upcast automatically up casting upcasting in java downcasting java Upcasting and downcasting upcasting and downcasting in java how to find the class of an upcasted object in java upcasting and downcasting in java geeksforgeeks upcasting vs downcasting n java upcasting vs downcasting in javaa java upcasting upcasting and sdown casting what is upcasting in java Upcasting Downcasting upcast vs downcast upcast in java what is the difference between downcast and upcast upcasting java downcasting in java what is downcasting what is upcasting upcasting vs downcasting upcasting vs downcasting in java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source