CS 111 Notes Exam 1

3 Pages
Unlock Document

Computer Science
CAS CS 111
David Sullivan

CS 111 Notes Programming in Java Most basic syntax: public class name { //this is the header public static void main(String[] args) { //this is the main method System.out.println(“hello, world”); } } integrated development environment (IDE) – app that helps you develop programs ex. Drjava identifiers must begin with a letter, $, or _ can be followed by anything but spaces cannot be a keyword style capitalize class names do not capitalize method names capitalize internal words within name string literal must be enclosed in double quotes cannot span multiple lines escape sequence: ex. \\ backslash; \n newline. \t a tab Procedural Decomposition Code duplication is undesirable b/c takes too much time and will have to changeALL duplications if change is wanted static method – simple methods public static void () { ; … } comments – text ignored by the compiler line comments: begin with // block comments: begin with /* and end with */ Primitive Data, Variables and Expressions; Simple Conditional Execution Steps to developing a program 1. analysis and specification 2. design 3. implementation 4. testing and debugging literals – specifies a particular value string literals: “you r dumb” numeric literals: 25.68 variables: named memory locations used to store a value and follows rules for identifiers statements – single line statements typically end with a semi-colon expressions: pieces of code that evaluate to a value includes literals, variables, and their combos numerical operators include + addition - subtraction * multiplication / division % modulus/mod data types: set of related data values ex. integers, strings, characters declaring a variable: ; can include more than one variable of same type assignment statements – used to give a value to a variable = is known as the assignment operator does not create a permanent relationship between variables integer division – discards fractional part of result floating-point division – keeps fractional part of result string concatenation meaning of + operator depends on types of operands when at least one of operands is a string, string concatenation is performed if one is a string and other is a number, the number is converted to a string and then concatenated type casts ()
More Less

Related notes for CAS CS 111

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.