This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Integer data type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Integer data type" Watch "Integer data type" New topic
Author

Integer data type

jaysingh solanki
Greenhorn

Joined: Nov 11, 2003
Posts: 14
cosde:
public class Lit{
public static void main(String[] argv){
int i = 18;
int j = 022;//Octal version: Two eights plus two
int k = 0x12;//Hex version: One sixteen plus two
long f=1.2L;
System.out.println(i);
System.out.println(j);
System.out.println(k);
System.out.println(f);
}
}
My Question:How i assign long value to f
if i put 1.2L or 1.2l it give
error Invalid character in number.
dennis zined
Ranch Hand

Joined: Mar 07, 2003
Posts: 330
long f=(long)1.2;


SCJP 1.4<br />SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integer data type
 
Similar Threads
About Overloaded Method?
Local Variables
A Programming Interview Question
Why the result of printing out the not-letter chars to console is different from to applets
Ambiguous Reference to method