Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.

Slides:



Advertisements
Similar presentations
Overloading Having more than one method with the same name is known as overloading. Overloading is legal in Java as long as each version takes different.
Advertisements

AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Intro Programming By Trevor Decker Team 1743 By Trevor Decker Team 1743.
Your First Java Program: HelloWorld.java
Chapter 2: Your First Program! Hello World: Let’s Program  All programs must have the extension.java  Our first program will be named: HelloWorld.java.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
Introduction to Methods
Java Unit 9: Arrays Declaring and Processing Arrays.
“Introduction to Programming With Java”
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Hello AP Computer Science!. What are some of the things that you have used computers for?
2.2 Information on Program Appearance and Printing.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Arrays (Part 1) Computer Science Erwin High School Fall 2014.
Welcome to the Lecture Series on “Introduction to Programming With Java”
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
The Java Programming Language
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 6 l Array Basics l Arrays and Methods l Programming with Arrays.
Comments in Java. When you create a New Project in NetBeans, you'll notice that some text is greyed out, with lots of slashes and asterisks:
Output in Java Hello World!. Structure of a Java Program  All Java files in ICS3U1 have the following structure: class HelloWorld { }  Notice the open.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Can we talk?. In Hello World we already saw how to do Standard Output. You simply use the command line System.out.println(“text”); There are different.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) public static void main(String[]
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
Working With Objects Tonga Institute of Higher Education.
1 WELCOME TO CIS 1068! Instructor: Alexander Yates.
Lab 01-2 Objectives:  Writing a Java program.  How to send output to the command line console.  Learn about escape sequences.  Learn how to compile,
CSI 3125, Preliminaries, page 1 Compiling the Program.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Arrays-. An array is a way to hold more than one value at a time. It's like a list of items.
Chapter 4Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapters 4 and 5: Excerpts l Class and Method Definitions l Information.
OOP Basics Classes & Methods (c) IDMS/SQL News
CSC 110 – Intro to Computing - Programming
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
CS 177 Recitation Week 1 – Intro to Java. Questions?
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Chapter 3 Introducing Java. Objectives and Goals 1. Define terminology associated with object- oriented programming. 2. Explain why Java is a widely used.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Chapter 1 Object Orientation: Objects and Classes.
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
Java Fundamentals MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
An Introduction to the Java Language App Design Flat Rock Community Schools Introductory Java Programming.
Introduction to programming in java
Computer Programming Your First Java Program: HelloWorld.java.
(A crash-course overview for humanities folk) Part I
Intro to Java.
Statements, Comments & Simple Arithmetic
Writing Methods.
Tonga Institute of Higher Education
Java Intro.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
Introductory Java Programming
LCC 6310 Computation as an Expressive Medium
Methods/Functions.
How to Run a Java Program
Presentation transcript:

Hello Computer Science!

Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening. class HelloWorld { public static void main(String [] arg) { //This will print our message to the world System.out.println("Hello World!"); }

class - indicates that you are starting a class HelloWorld - the name of the class JAVA is what is known as an object oriented language. Because of that, ALL code is in some way attached to or as some would say encapsulated inside of a class. The main reason for this is organization although there are other benefits as well. There are other lower level programming languages that are procedural and ultimately all code behaves in a procedural manner on the CPU. You can think of this as filing papers in filing cabinets versus leaving them in a huge stack in the middle of the room.

All code for both a class as well as a methods, loops, and if statements is demarcated with an open and close curly. Programmer Tip – Be careful about the placement of a curly. Sometimes you will find that you will have multiple things nested inside of others and it becomes hard to tell when one thing starts and another ends. INDENTING helps with this!!!!!!

Within each class are variables and methods. Inside methods we put our lines of code that actually run. The reason that we call these things methods is that they define how our classes do certain things. Our method declaration is as follows: public static void main(String [] arg)

public – indicates that this method is public which means that can be called from outside the class static – indicates that this method is static which means we do not have to create an instance of the class before we can call the method main – the name of the method (String [] arg) – indicates the input variable(s), in this instance it is an array of Strings called arg. String variables can hold text and the brackets ([]) indicate that it is an array which can hold multiple values

System.out.println – in this part of our code we are calling the println method of the out class which is contained inside the System class. Where this will print out to is dependent on the computer that we are running it on. (“HelloWorld”) – The open and close parenthesis contain whatever we are passing into our method. We use the double quotes to start and end our String that we pass in to the method. ; - after every variable declaration and line of regular code, we have to include a semi colon

Didn’t we miss something? What about that whole line of code that went: //This will print our message to the world Well that doesn’t do anything, for the computer anyway. That is a comment. For the programmer it could do a lot. It lets you know what a class, method, code, or variable does without interfering with the working of code. Sometimes it even helps to write all your comments before you type a single line of code! You can put comments into your code by putting a double slash. Or to put in comments with carriage returns you can use a slash star combo like so: /*This will print our message to the world*/

Recital Time!