Java for Complete Beginners (Video), Part 3: Strings

In the third part of the Java tutorial for beginners video series, we look at working with text using the String class. We also get our first real peek at using classes and objects.

Code for this tutorial:


public class Application {
	public static void main(String[] args) {
		
		int myInt = 7;
		
		String text = "Hello";
		
		String blank = " ";
		
		String name = "Bob";
		
		String greeting = text + blank + name;
		
		System.out.println(greeting);
		
		System.out.println("Hello" + " " + "Bob");
		
		System.out.println("My integer is: " + myInt);
		
		double myDouble = 7.8;
		
		System.out.println("My number is: " + myDouble + ".");
	}
}


Hello Bob
Hello Bob
My integer is: 7
My number is: 7.8.

Learn to program Java Swing with my complete video course – desktop programming and applets. Includes 7 free videos. Click here for details.

All pages on this site are copyright © 2013 John W. Purcell

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