This is the second video on java programming--Data Types, a little more advanced, below is a little practice/challenge.
CODE:
public class variables{
public static void main(String[]beans){
char a='A';
String b="I Like Cheese";
int c=10;
double d=1.5;
float e=5462.56235426457345754f;
long f=9999999999l;
System.out.println(a+"\n"+b+"\n"+c+"\n"+d+"\n"+e+"\n"+f);
}
}
CHALLENGE/PRACTICE:
Create Strings containing your First, Middle and last name. Ints that contain your age and birth year. And doubles that print your salary and the time (use a "." insteas of a ":")
Channel: Science & Technology Uploaded: February 16, 2008 at 9:24 pm Author:Longhorndude08
Vambreaker23(Friday 26th of December 2008 06:48:41 AM)
Why is it necessary to write a "l" at the end when you declarated the long..??
Longhorndude08(Friday 26th of December 2008 03:25:04 PM)
So the computer can differentiate it from an int
Vambreaker23(Saturday 27th of December 2008 07:28:47 AM)
But it's "long f=80769876978l;".
You differentiale it with the "long" at the beginn or? Is it necessary to put the l the end too? Thanks for help
Longhorndude08(Saturday 27th of December 2008 02:23:49 PM)
Did you even watch the video???
long x=9999999999l; - Without the l you will get a compilation error just like it did in the video
Longhorndude08(Saturday 27th of December 2008 02:27:45 PM)
The reason you put the l is the same reason you can't put int x="55"; - "55" is not an int, it's a String... 999 isn't a long, it's an int and vice versa
Vambreaker23(Sunday 28th of December 2008 03:56:25 AM)
ok I think I got it
IMPgenesis(Friday 5th of December 2008 12:48:37 AM)
dude double is longer than float
TheGhostMan23(Friday 14th of November 2008 08:01:39 AM)
How do I do single quote?
can someone say the program as a comment? what the red thing after "a" a star? *?
JavaPrograming(Friday 14th of November 2008 07:56:20 PM)
it's an = sign, ex. int num=5;
Longhorndude08(Saturday 22nd of November 2008 10:18:26 PM)
For a single quote it's the same as " but without holding down shift - '