Beginning Programming
Introduction
In this course you will learn how to solve problems by writing computer programs using the Java programming language. Like natural languages, programming languages also have their grammar (syntax) and rules of usage. You will become familiar with the syntax and comfortable with problem solving by practicing in the scratch pad area. Let us get started by printing the message "Welcome to Java!" on the console. Type the following in the scratch pad and run it
System.out.println("Welcome to Java!");
The message Welcome to Java! appears on the output window.
System.out.println("Welcome to Java!"); is a Java statement. Write a statement to print "Java is easy" and try it out on the scratch pad. System.out.print() is another command that can be used to print to the console, use it to print the message "Java is fun" on the scratch pad. Do you see the difference between System.out.println and System.out.print? In the latter command, there is no newline after the message you print, so the cursor remains on the same line. Java is case sensitive, so you must preserve the case rules expected. So, try the following in the scratchpad. Correct it to make it work. system.out.println("Case matters!");
Java is case sensitive
No comments:
Post a Comment