Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners type casting and conversion
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hina Saeed
type casting and conversion
1 Answer(s)      6 years and 8 months ago
Posted in : Java Beginners


I am beginner and my query is Importance of type casting and conversion


Advertisement
View Answers

April 11, 2008 at 7:16 PM


Hi friend,

public class TypeCasting{
public static void main(String[] args){
boolean t = true;
byte b = 2;
short s = 100;
String str = "String";
System.out.println("All variable display like this.");
System.out.println("b = " + b );
System.out.println("s = " + s );
b = (byte)(t?1:0);
System.out.println("Value of b after conversion : " + b);
//Convert from boolean to short.
s = (short)(t?1:0);
System.out.println("Value of s after conversion : " + s);
}
}

------------------------------
Read for more information,

http://www.roseindia.net/java/


Related Tutorials/Questions & Answers:
type casting
type casting  what is type casting
Casting (Type Conversion)
Casting (Type Conversion)      ... as downcasting. Explicit Conversion (Casting) Automatic type casting does work... to another type. Conversion of data from one type to another type is known as type
Advertisements
Type casting
Type casting  how to type cast a string value to byte array
type casting
List (object type) <Object> totalList(int pi){ try{ Query q...type casting  <--bean class-->method calllist is of object type...){ return null; } how to type cast object type to entity type
type casting
type casting  int n=20; n=sizeof((char)(float)n); what is n value
type casting purpose
type casting purpose  what is type casting , could u explain with practical example
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...;Value of b after conversion : " + b); //Convert from boolean to short. s
Type casting in java
word type casting is a conversion of one data type to another data type ...Type casting in java In this section you will learn about type casting in java. Type casting is to convert one type to another type. Java support two types
Java Type Casting - Java Beginners
Java Type Casting  what is object type casting? give some example with related
Java type casting
Java type casting  What is Downcasting
Java type casting
Java type casting  Can a Byte object be cast to a double value
Type casting the returned value of a method.
Type casting the returned value of a method.  Hi, How do you type cast the returned value of a method so that you can avoid creating a temporary... know that the component returned by panel.getComponent(i) will be of type
java type casting problem - Java Beginners
java type casting problem  what is type casting? what is the type of type casting? explain with example?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/TypeCasting.shtml
Type Conversion - Java Beginners
Type Conversion   Hai, rajanikanth, Please explain how to convert from integer value to a string value .In a database operation i want to convert... for conversion
HSSFCell to String type conversion
HSSFCell to String type conversion  Hello, Can anyone help me convert HSSFCell type to string. There is a solution in the following URL, but the method getWorkbook() is not defined for the class HSSFCell. Thanks in advance
Data Conversion from double to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from double primitive type to another data type like String, boolean and char etc
Data Conversion from long to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from long primitive type to another data type like String, boolean and char etc
Data Conversion from float to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from float primitive type to another data type like String, boolean and char etc
Data Conversion from short to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from short primitive type to another data type like String, boolean and char etc
Data Conversion from byte to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from byte primitive type to another data type like String, boolean and char etc
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Introduction to Type conversion in Struts
Introduction to Type conversion in Struts Type conversion is a mechanism... this powerful and important facility. In struts the type conversion is an mechanism... are converted into complex bean properties using this type conversion mechanism
Type conversion example
Type Conversion Example An example of type conversion is given below, which... invalid.fieldvalue.submissionDate=Please enter a date in yyyy-mm-dd format Now make a type conversion...;style type="text/css">@import url(css/main.css);</style> <
What is casting?
What is casting?   Hi, What is casting? thanks
How to customize property type conversion errors in Spring MVC 3.
How to customize property type conversion errors in Spring MVC 3.  Hi... the form, I receive a type conversion error: Failed to convert property value of type java.lang.String to required type java.lang.Integer for property age
Conversion from string data type into different data types.
Conversion from string data type into different data types.  string str="World id Beutifull"; char chr[20]; char* chrctr ; Qustion is -How to store the 'str' value in 'chr' and 'chrctr'? int abc; sprintf(abc ,"%s",str
Casting in java - Java Beginners
Casting in java   Hi, I want to know Casting in detail... is implicit casting and Explicit casting . Implicit casting : Ex - assign... Explicit casting : Ex - Assign superclass variable to subclass
PHP Type Juggling
Type Juggling In PHP: Unlike other programming languages like C,C++ and Java... a float value to a variable then it becomes float type and if we assign... type, but if we add one integer and one float type variable then the result
PHP Integer Data Type
Learn PHP Integer Data type: In PHP integers can be decimal which is a normal... data type is platform dependent. Usually the size of integer is 2 million in 32... type. PHP Integer Data Type Example: <?php $a=12; echo"
conversion Applet
conversion Applet  I am a java beginner.................. strong texthow to create JApplet that prompts the user to enter a distance in miles in a JTextField and then converts mile to kilometers and display the result as XX.XX
Advertisements
 

 

 

DMCA.com