Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,872 questions

51,796 answers

573 users

What are the primitive data types in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        byte b = 2;
        System.out.println("Byte: " + b);

        short s = 12;
        System.out.println("short: " + s);

        int i = 8782;
        System.out.println("Integer: " + i);

        long l = 94847;
        System.out.println("Long: " + l);

        float f = 3.14f;
        System.out.println("Float: " + f);

        double d = 9477234.987;
        System.out.println("Double: " + d);

        char ch = 'z';
        System.out.println("Char: " + ch);

        boolean bl = true;
        System.out.println("Boolean: " + bl);
    }
}




/*
run:

Byte: 2
short: 12
Integer: 8782
Long: 94847
Float: 3.14
Double: 9477234.987
Char: z
Boolean: true

*/

 



answered Mar 2, 2021 by avibootz

Related questions

1 answer 175 views
1 answer 267 views
1 answer 227 views
1 answer 207 views
1 answer 213 views
1 answer 216 views
1 answer 193 views
...