Java programming

Java was originally called Oak but upon discovering there was another programming language with the same name, the development team renamed it to Java after one of the brands of coffee available in a local shop.
The language grew out of a project to develop a personal digital assistance [PDA], i.e., a device that is intended to control all electronic devices used in our homes. It is fully object oriented and is used in the  creation of two types of programs; applets and applications. However, it is mostly used in writing animated web pages using applets.

Java Notes

Java Essentials
Arrays, Strings and control flow statements
Creating Objects
Graphical User Interfaces

Java Math class

Displaying a Single Line of Text with Multiple Statements

Welcome to Java Programming! can be displayed several ways. Class Welcome2, shown in Fig. 2.3, uses two statements (lines 9–10) to produce the output shown in Fig. 2.1. [Note: From this point forward, we highlight the new and key features in each code listing, as we’ve done for lines 9–10.]

	// Fig. 2.3:
2	// Printing a line of text with multiple statements.

	public class Welcome2
6	// main method begins execution of Java application
	public static void main( String[] args )
	System.out.print( "Welcome to " );
	System.out.println( "Java Programming!" );

	} // end method main

	} // end class Welcome2

Welcome to Java Programming!

Displaying Multiple Lines of Text with a Single Statement

A single statement can display multiple lines by using newline characters, which indicate to System.out’s print and println methods when to position the output cursor at the beginning of the next line in the command window. Like blank lines, space characters and tab characters, newline characters are white-space characters. The program in Fig. 2.4 out-puts four lines of text, using newline characters to determine when to begin each new line. Most of the program is identical to those in Fig. 2.1 and Fig. 2.3

	// Fig. 2.4:
2	// Printing multiple lines of text with a single statement.

	public class Welcome3
6	// main method begins execution of Java application
	public static void main( String[] args )
9	System.out.println( "Welcome \nto \nJava\nProgramming!" );
	} // end method main

	} // end class Welcome3
to Java


2 thoughts on “Java programming

Leave a Reply