Share on Google+Share on Google+

Virender Saini
1 Answer(s)      5 years and 8 months ago
Posted in : Java Beginners

Hi,,plz give me explanation of upcasting and downcasting using reference with examples.

View Answers

September 1, 2011 at 3:43 PM

Upcasting is the conversion of data type from lower range data type to higher data type eg: int to long, byte to long, int to double etc.

Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy.eg: double to byte, long to int etc.

For more information,

Visit Here


Related Tutorials/Questions & Answers:
Double To Int Without TypeCasting
Double To Int Without TypeCasting  How to convert Double to Int without using typecasting?   class ConvertDoubleToInt { public static void main(String[] args) { double d=25.5; int num=new
type casting - Java Beginners
type casting and conversion  I am beginner and my query is Importance of type casting and conversion  Hi friend,public class TypeCasting{ public static void main(String[] args){ boolean t = true; byte b = 2; short s
Theory - Java Beginners
typecasting is used otherwise explicit typecasting is used. b)Any positive integer
Change case in C language
toupper() and strupr() but having typecasting error. Thanks in advance Ankita
Regarding Login application program
is not initializing myform Logf=(myform)form; And while typecasting
Convert Hexa To Char
the char value which the convert in char number by typecasting. Type casting
Convert Char To Byte
by typecasting and then print the value at the console. Here is the code
Java clone method example
the typecasting that needed to assign the generic object to a reference of my class
Introduction to Generics in Java
are typecasting the String into Integer at runtime it will give you error. So, using
PHP Type Juggling
of implicit typecasting is if we add two integer variables then the result is integer
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java


Advertisement null