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,970 questions

51,912 answers

573 users

How to use literals in Java

1 Answer

0 votes
package javaapplication1;

// A literal variable with a fixed value
// Literal variable of a primitive type

public class LiteralsTest {
    public static void main(String[] args) {
	    boolean bool = true;
        char ch = 'a';
        byte b = 100;
        short s = 30000;
        int i = 600000;
        long l = 90000000;
        
        System.out.println(bool);
        System.out.println(ch);
        System.out.println(b);
        System.out.println(s);
        System.out.println(i);
        System.out.println(l);
        
    }
}

/*
run:

true
a
100
30000
600000
90000000

*/

 



answered Jan 8, 2016 by avibootz
edited Jan 8, 2016 by avibootz

Related questions

1 answer 150 views
1 answer 148 views
1 answer 185 views
1 answer 192 views
192 views asked Jan 8, 2016 by avibootz
2 answers 204 views
...