Java Data Types @ Lifebix

java data types

Java Data Types:

1.Int Data Types:
In below example is int Data Type Program.
class IntExample
{

public static void main(String[] args)
{
int a=15;
int b = 25;
int c =30;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Output:
15
25
30

2. Byte DataTypes:
In below example is byte Data Type Program.
class ByteExample
{

public static void main(String[] args)
{
byte a=23;
byte b = 27;
byte c =35;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Output:
23
27
35

3.short Data Types:
In below example is short Data Type Program.
class ShortExample
{

public static void main(String[] args)
{
short a=18;
short b = 36;
short c =28;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Output:
18
36
28

4.long Data Types:
In below example is long Data Type Program.
class LongExample
{

public static void main(String[] args)
{
long a=12;
long b = 56;
long c =65;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Output:
12
56
65

5.double Data Types:
In below example is double Data Type Program.
class DoubleExample
{

public static void main(String[] args)
{
double a=11.7;
double b = 43.2;
souble c =56.7;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}

Output:
11.7
43.2
56.7

6.float Data Types:
In below example is float Data Type Program.
class FloatExample
{

public static void main(String[] args)
{
float a=19.3f;
float b = 32.7f;
float c =71.3f;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}

Output:
19.3
32.7
71.3
7.char Data Types:
In below example is char Data Type Program.
class CharExample
{

public static void main(String[] args)
{
char a=’p’;
char b = ‘q’;
char c =’r’;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}

Output:
p
q
r

8.boolean Data Types:
In below example is boolean Data Type Program.
class BooleanExample
{

public static void main(String[] args)
{
boolean a=true;
bboolean b = false;

System.out.println(a);
System.out.println(b);

}
}

Output:
true
false
Here we are giving all the Data Types in a single program.
class All DataTypes
{

public static void main(String[] args)
{
byte p=17;
short q=32;
int r=10;
long a=47;
double c = 10.35;
float d = 10.32f;
char h =’a’;
boolean p=true;
System.out.println(p);
System.out.println(q);
System.out.println(r);
System.out.println(a);
System.out.println(c);
System.out.println(d);
System.out.println(h);
System.out.println(p);
}
}
Output:
17
32
10
47
10.35
10.32
a
true

35 thoughts on “Java Data Types @ Lifebix”

  1. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove people from that service? Thanks!|

  2. Fantastic post but I was wanting to know if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit more. Kudos!|

  3. Unquestionably believe that which you said. Your favorite reason appeared to be on the web the easiest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly do not know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks|

  4. I will right away seize your rss as I can not find your e-mail subscription hyperlink or newsletter service. Do you’ve any? Kindly let me realize so that I may just subscribe. Thanks.

  5. Great goods from you, man. I’ve take into accout your stuff prior to and you are just extremely great. I actually like what you’ve got right here, really like what you’re stating and the best way during which you are saying it. You make it enjoyable and you still take care of to keep it wise. I can’t wait to learn far more from you. This is actually a wonderful website.

  6. Very nice post. I simply stumbled upon your weblog and wished to say that I have truly enjoyed surfing around your blog posts. After all I will be subscribing in your rss feed and I hope you write again very soon!

Leave a Reply

Your email address will not be published.