Learn Java Tutorial for Beginners (Video), Part 2: Using Variables

In this second part of the Java tutorial for beginners series, we look at declaring and initializing variables -- one of the most basic building blocks of any computer program.



Code for this tutorial:

 
public class Application {

    public static void main(String[] args) {
        int myNumber = 88;
        short myShort = 847;
        long myLong = 9797;
        
        double myDouble = 7.3243;
        float myFloat = 324.3f;
        
        char myChar = 'y';
        boolean myBoolean = false;
        
        byte myByte = 127;
        
        
        System.out.println(myNumber);
        System.out.println(myShort);
        System.out.println(myLong);
        System.out.println(myDouble);
        System.out.println(myFloat);
        System.out.println(myChar);
        System.out.println(myBoolean);
        System.out.println(myByte);
    }

}

 
88
847
9797
7.3243
324.3
y
false
127