Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 131 Computer Science 1 Module 1: (basics of Java)

Similar presentations


Presentation on theme: "CSE 131 Computer Science 1 Module 1: (basics of Java)"— Presentation transcript:

1 CSE 131 Computer Science 1 Module 1: (basics of Java)

2 Welcome to CSE 131 Professor: Yixin Chen Head TA: Sam Donohue URL: http://classes.engineering.wustl.edu/cse131/http://classes.engineering.wustl.edu/cse131/ Discussion forum: https://piazza.com/wustl/spring2015/cse131501n/home All emails: cse131wustl@gmail.comcse131wustl@gmail.com

3 Logistics Structure of the course »Lecture, studios, labs, exams Feel free to ask questions »We move pretty fast (learn it while you are here) »Getting help: office hours, recitations, tutoring Expect to spend lots of time programming »Practice makes perfect Zero tolerance on cheating!! Reading assignment before each lecture »It’s for your best interest to finish it

4 CS: Automation of processes CS is about automation of computation and processes Computers and computer software are everywhere »laptops, cell phones, game systems, music players, televisions, networks, cars, medical devices, appliances

5 How Do Computers Work?

6 A Little About Computers Conceptually very simple Memory is storage of data: an array of numbered storage locations »each location can store a numeric value »each location identified by its address Processor is a device that carries out simple machine instructions M[2] <= M[3] M[2] <= M[3] + M[4] (also, -, *, /,...) if M[3] > M[0] then skip ahead 3 (or “go back 5”) M[M[1]] <= M[2] + M[M[4]] (one location “refers” to another) Modern processor can carry out >10 9 instructions/sec So what is programming? – composing instructions to do a certain task 0123401234... Memory Processor Program

7 Programming Languages

8 The Java Programming Language Developed by Sun in 1991 for a Green Project for refrigerators The project failed, but Java thrived Today, 1.1 Billion devices are running java

9 Welcome to the World of Java

10 Eclipse Integrated Development Environment (IDE) »“smart” editing of Java programs – continuous syntax checks »compiles program files automatically as necessary »integrated program testing and debugging tools »has plug-ins for version control system (Subversion) Can be a powerful tool for managing large projects »but, can also be a bit overwhelming and mysterious at first »watch the first few Eclipse videos on the web site before lab works the same way in Windows, Mac and Linux

11 Your First Program public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } } »defines a class called HelloWorld (a class defines an object) »class contains a single method called main in Java, the main method is the starting point of a program the main method has an array of arguments (not used here) Any program has one and only one main() method »program “prints” a brief message and halts

12 Today: understand basic building blocks of JAVA You will be able to »Output a slogan on the screen »Tell if a year is a Leap Year »Calculate the area of a circle »Output anything you like »Do all kinds of calculation

13 Basic unit: variable A variable in Java is a piece of information stored in a computer’s memory: like a jar holding food Each variable has a type »Like different kinds of jars (different food, size, usage, etc.) Main types: int a; double b; String s; boolean x;

14 Basic Data Types in Java Type (keyword)MeaningExamplesPrimitive Operators intInteger3, 0, -5, 256+, -, *, / doubleDecimal number1.5, -3.1415, 0.0+, -, *, / booleantrue or falsetrue, false&&, ||, ! (return boolean:, =,!=, ==) Stringa sequence of characters “hello world”+ (concatenation)

15 15 Basic Definitions Type. A category of values and a set of operations on such values. Variable. A name that refers to a value of a declared type. Assignment statement. Associates a value with a variable. type

16 The int type

17 Integers This surprises most students. Don’t feel bad: experts forget this too sometimes.


Download ppt "CSE 131 Computer Science 1 Module 1: (basics of Java)"

Similar presentations


Ads by Google