Unformatted text preview:

IDE is an integrated development environment we use eclipse It does Lecture 1 1 2 3 4 text editor type in program compile java machine code run program run debugger CVS concurrent versioning system a place where you can stick files Computer systems 1 Hardware the physical components Lecture 2 CPU central processing unit the brain RAM random access memory main primary memory Holds information the computer is working on at the time Temporary cid 0 cid 0 FAST A byte address 6533 Secondary memory 10011011 10010111 6534 cid 0 Permanent storage of data PERMANENT SPACIOUS I O devices input output devices Touchscreen monitor is both input and output 2 Software Applications everything but the operating system Operating system a program that automatically runs cid 0 cid 0 cid 0 cid 0 cid 0 cid 0 cid 0 Process management decides which process is running using CPU at which time it switches between processes so fast it looks like the processes are running simultaneously Memory management keeps track of which process is using what block of memory Basic I O Windowing GUIs Basic network control Network a bunch of computers that can talk to each other Security enforcement passwords Information storage with bytes and bits a bit a thing with 2 states 0 or 1 a byte 8 sequential bits kilobyte 1024 bytes 210 megabyte 220 1mil bytes gigabyte 230 bytes Integers are stored by converting the decimal number to base 2 positive and negatives are represented by 2s complement Floating point numbers are stored by converting to scientific notation and then converting the number and power of ten to binary attaching them together and storing in byte s Characters are stored using codes which are then turned into binary We now use Unicode 65536 symbols rather than ASCII 256 symbols because we need more symbols for other languages Software keeps track of what is where we cannot tell from looking at a byte what kind of information it holds Programming languages CPU speaks machine code 0s and 1s where bits are instructions Assembly language is basically machine but uses numonics efficient execution and use of space used in embedded devices like appliances used in embedded devices like appliances each CPU has its own machine code assembly language Timeline of higher level languages 50s early 60s late 60s 70s 80s late 80s 90s FORTRAN Science cobalt Buisness Algol fist language with modern features Pascal Education C efficient code error prone great but procedurally oriented C object oriented C has sharp edges aka mysterious bugs JAVA became popular object oriented idiot proof disadvantage slow compared to C Object v Procedure oriented languages Object oriented languages center around nouns for classes Procedure oriented languages center around verbs The most important difference is that you can recycle classes in object oriented programming Polymorphism you can extend and object oriented class and modify Add features to it 6 5 09 General Lecture 3 How many different combinations of 0s and 1s are there in a byte 28 Every time you add a bit it doubles the number of combinations n bits give 2n combinations of 0s and 1s Another advantage of Java is that it is portable so it can run on different platforms computers OS Some basic definitions Object principal entity manipulated by a program design for an object Class Method chunk of code with a name every program starts with the main method Statement one instruction step for the program to do ends with a semicolon Notes on Java programs Comments can span many lines single line comment Println v print Println puts the cursor on a new line enter Typically the compiler translates the program into machine code creates an executable but executables are not portable Thus Java complies source code into byte code universal code that is half way between java and machine code but is not specific to a platform Then the JVM java virtual machine translates and runs the byte code one line at a time 2 disadvantages 1 must have Java installed on your machine 2 this is SLOW Variable declaration only do this once Type variable Creates a box in the stack with the name variable Assignment statement Variable value Puts the value in the variable box in the stack is the assignment operator value variable stack Concatenation Joining things together using the operator Java can turn anything into a string Primitive types 8 Integer types 4 Long int short byte 8 bytes 4 bytes 2 bytes 1 byte Floating point types 2 range of values 263 1 up to 263 range of values 2 bil up to 2 bil range of values 32768 up to 32767 range of values 128 up to 127 Floating point types 2 Double Float 8 bytes 4 bytes Other types 2 main advantage more precision sig digits Char Boolean depends on JVM 2 bytes true or false stores one symbol ex t Between 1 bit and 1 byte 6 8 09 Lecture 4 Programming errors Syntax something typed in wrong not a java statement Logical valid java program but malfunction Arithmetic Operators Comparison operators return a boolean Scanner modulus operator returns remainder Allows you to get text from the user Scanner x new Scanner System in creates a new Scanner object x nextInt reads input Possible reading commands nextInt nextDouble nextByte nextFloat nextBoolean next gets a string but stops when it gets to the first white space nextLine reads until it reaches an enter Integer Division Returns a truncated integer 0 Find the length of a String s s length Compare objects not just primative types Don t use Use x equals y If and If else statements if x y else parenthesis is true or false Logical operators not unary operand statement on right or and binary operators 2 operands The stuff inside the if block may or may not run depending on whether the stuff in if A B runs if A is true B is true or A and B are true if A B runs iff A and B are true if x y same as if x y if x equals y 6 10 09 Short Circuiting Lecture 5 Java will not evaluate the clause on the right of a logical operator if it is not needed Example 1 if x 6 y 10 if x 6 y 10 when x is 100 x 6 is false so y 10 is not evaluated when x is 4 x 6 is true so y 10 is not evaluated If statements Nesting and else if An if block or if else block is one statement thus you can nest if and if else statements Else if is the same as else if just without parentheses Identifiers letters digits may be used can t start with a digit no key words of Java may be used it is best not to start with a Camel Case style Variables and methods smallestIntergerSeen Classes and


View Full Document

UMD CMSC 131 - Lecture notes

Documents in this Course
Set #3

Set #3

7 pages

Exam #1

Exam #1

6 pages

Exam #1

Exam #1

6 pages

Notes

Notes

124 pages

Notes

Notes

124 pages

Load more
Download Lecture notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?