Java: Type Conversion, Statements and Loops
[Pages:27]Java: Type Conversion, Statements and Loops
Instructor: Nihshanka Debroy
Type Conversion: Type I
Assignment Conversion
int smallerType = 2; // 1) ASSIGNMENT CONVERSION (converts the int to a double) double largerType = smallerType; System.out.println("Assignment Conversion: "+largerType);
Type Conversion: Type II
Arithmetic Promotion
// 2) ARITHMETIC PROMOTION (answer will be a double) double big = 100.36; int small = 2; double answer = big / small; System.out.println("\nArithmetic Promotion:"+answer);
Type Conversion: Type III
Casting
// 3) CASTING double d = 100.36; int i = (int)d; System.out.println("\nCasting:"); System.out.println("Integer Value = "+i); System.out.println("Double Value = "+d);
8 primitive data types : mnemonic aid
boolean char byte short int long float double
Be Careful, Bears Shouldn't Ingest Large Furry Dogs
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- crash course in java
- java basic syntax
- how to run a java program
- java type conversion statements and loops
- the hacker s guide to javac
- java strings and methods
- hello world in java hello world in python
- mips hello world mips assembly 1 virginia tech
- web dynpro tutorial hello world archive
- vfcjava lab 0 hello world mit opencourseware
Related searches
- positive statements and normative statements
- healthcare financial statements and ratios
- financial statements and their purpose
- fact statements and opinion statements
- java type casting char to int
- conditional statements and equivalence
- conditional statements and equivalence quiz
- type conversion in java
- java type convert
- wells fargo statements and documents
- citi card statements and payments
- compound statements and connectives examples