Hello World

/* * David Huang */ /** * Write a short description of what the class does (one line) * @author (your name) * @version (a version number or a date) */ import java.util.*; public class HelloWorld//class header { //every open bracket need a closed bracket //main method below is ignition of a program (not every class has one) public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a Number: "); int myNum = sc.nextInt(); //prints "Hello, World" to the console //each line ends in semicolon int num = 6; double myDouble = 6.707; myNum = myNum + num; String myString = "Printing Numbers: "; System.out.println(myString + myNum + " num: " + num); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.