Download Creating Your First Computer Program in Java ()

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Falcon (programming language) wikipedia , lookup

Class (computer programming) wikipedia , lookup

Library (computing) wikipedia , lookup

Scala (programming language) wikipedia , lookup

Structured programming wikipedia , lookup

Program optimization wikipedia , lookup

Go (programming language) wikipedia , lookup

C++ wikipedia , lookup

Name mangling wikipedia , lookup

History of compiler construction wikipedia , lookup

C Sharp syntax wikipedia , lookup

Compiler wikipedia , lookup

Object-oriented programming wikipedia , lookup

One-pass compiler wikipedia , lookup

Java (programming language) wikipedia , lookup

Interpreter (computing) wikipedia , lookup

Java performance wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Transcript
Creating Your First
Computer Program in Java
Margaret Yau
Impacts of Software
The Internet
WWW
- over 109.9 million active websites
- estimated 1.5 billion Internet users
(~ 5 x U.S. Population)
- 14.3 billion searches by Americans in May 09
- Microsoft: the world’s largest software company
- company worth $36 billion (2008)
- over 400 million copies of Windows XP sold
- the largest social networking site
- company worth $3.75 – 5 billion
- more than 200 million active users
- over 21 million iPhones sold
- 50,000 applications available for download
Can you even imagine a day without using software?
Computer programming is
fun and powerful
And it is not just
for nerds
"I'm not coming down for dinner,
didn't you read my blog ?!?!"
Creating Your First Program in
• Java
– High-level
– Object-oriented programming (OOP) language
– Platform-independent
– Free and open-source
Three Important Parts of
Computer Programming
• Coding
• Compiling
• Testing
1. Coding
• Source Code: collection of statements or
declarations written in some human-readable
computer programming language
• A high-level way of communicating with the
computer
English:
Print the string “How are you?” to the computer screen.
Java:
System.out.println(“How are you?");
Coding Your “Hello World!” Java Program
Define a type of object (class)
Class name
class Hello
{
Define the main behavior (method)
public static void main ( String[] args )
{
System.out.println("Hello World!");
}
}
A statement that prints “Hello World!”
to the main output device
<class name>.java
2. Compiling
• A compiler translates source code in a highlevel language to code in a low-level language
that a particular type of machines
understands (often binary form)
Source code
(Hello.java)
class Hello
{
public static void main
{
System.out.println…
Compiler
(javac)
Object code
(Java bytecodes:
Hello.class)
10001010
01010011
11110101
10010101
01010011
11110101
10010101
10010101
Compiling Your Java Program
javac <source file name>
Hello.java
javac
Source Code
Compiler
Hello.class
Object Code
3. Testing
• Execute the program
Processor
Object code
Machine
• Find software bugs (error, mistake, or failure)
• Verify that the program meets its
requirements
3. Testing
• Execute the program
• Find software bugs (error, mistake, or failure)
• Verify that the program meets its
requirements
Executing (Running) Your Java Program
java <class name>
Yay! I ran my first Java program!
You have
coded, compiled, and tested
your first computer program
in Java.
What’s Next
• Software can be designed to perform almost
anything computable.
• Observe and ask what people need, and use your
imagination…
e.g. program
- that really understands natural language
- that computes one quadrillion (1015) digits of π
- that reads your mind
- that creates original and artistic songs and poetry
And you may be the next …
Bill Gates
Microsoft
Steve Jobs
Apple
Larry Page
Sergey Brin
Google
Mark Zuckerberg
Facebook
Questions?