Java for Complete 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

Don’t forget, if you’re looking for an online Java tutor, you can get one-to-one tutorials from me; click here for details.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Posted in Java, Java Tutorial, Java Video Tutorials (Beginners) | Tagged , , , |