1 / 6

Introduction to Programming: Hello World App in Java

Learn how to create a simple Java program that prints "Hello World!" to the console. This tutorial covers the basic structure of a Java program, syntax errors, and common runtime errors.

Download Presentation

Introduction to Programming: Hello World App in Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COM S 207 The First Program Instructor: Ying Cai Department of Computer Science Iowa State University yingcai@iastate.edu

  2. Hello World! /** * The HelloWorldApp class implements an application * that simply prints "Hello World!" to standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string } } • A few things to note: • Plain text editor • Comments • Class definition • The main method • Object, method, parameters • Java is case sensitive • Coding style

  3. Basic Program Structure class CLASSNAME { public static void main(String[] args) { STATEMENT } }

  4. Common Errors • Compile-time errors • A program contains syntax (or grammar) errors • The Compiler does not understand your code, and so won’t translate your code into JVM instructions • Run-time errors • Your program runs, but does not produce correct results • Syntax is fine, but logic is wrong

  5. Start Edit Program Compile Program Syntax Error? Yes No Run Program Run-time Errors? Yes No End

  6. Announcements • Read chapter 2 (2.1, 2.2., 2.3)

More Related