* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Optimizing Matrix Stability and Controllability
Functional programming wikipedia , lookup
Reactive programming wikipedia , lookup
Java syntax wikipedia , lookup
Name mangling wikipedia , lookup
Go (programming language) wikipedia , lookup
Class (computer programming) wikipedia , lookup
Falcon (programming language) wikipedia , lookup
Scala (programming language) wikipedia , lookup
Structured programming wikipedia , lookup
Control flow wikipedia , lookup
Object-oriented programming wikipedia , lookup
C Sharp syntax wikipedia , lookup
Java (programming language) wikipedia , lookup
Honors 101, Fall 2006 • • • • • Please do not sit in back of room! Lots of info on web page Join the mailing list Download Eclipse and start using it Read the text book: we’ll quickly go through Chapters 1-5 • COME TO CLASS AND PARTICIPATE! • Attendance is required! Introduction to Computer Science • CS is lots of things • Key to all sides of CS is learning to be a good programmer • Not easy to teach or learn; like writing, comes with experience • Experimentation is a crucial part of the learning process • Documentation is a critical part of programming Why Java? • • • • • • • • • Relatively simple, but general-purpose Object-oriented, but with imperative basics Interpreted/Compiled Robust/secure Architectural-neutral/portable High-performance Multithreaded and distributed Clean! Powerful API, Java 2SE, JDK, IDE and JVM • The Application Programming Interface contains many predefined “classes” (and “interfaces”) upon which we will build. It is controlled by Sun. • The Java 2 Standard Edition is the current language standard (for applications and applets). • The Java Development Kit from Sun is a set of programs for developing, compiling and testing Java programs. The current version is JDK 5.0 (often called JDK 1.5). • Integrated Development Environments, built on top of the JDK, make using Java much more convenient. We will use Eclipse (free, from IBM). • The JDK compiles programs to “Java byte code”, which are then executed on the Java Virtual Machine by translating to “native” machine language. Intro to Java: Fundamentals First • Required text book by Liang • Part I (chapters 1-6): Fundamentals of Programming, that is using the traditional imperative/procedural model • Part II (chapters 7-11): Object-oriented programming • Part III (chapters 12-16): GUI programming • Part IV (chapters 17-19): Exceptions, I/O, recursion • We’ll cover almost the whole book Chapter 1: Introduction • Please read it before next class. • Intro to computers, number systems and Java Chapter 2: Data types and operations • • • • • • • Please read this also before next class Identifiers Variables Assignment statements, expressions Primitive types, strings Output: System.out.println Input: JOptionPane.showInputDialog Chapter 3: Conditional statements • • • • • Read as soon as possible Boolean type If statement Switch statement Precedence Chapter 4: Loops • • • • • Read as soon as possible While loop Do-while loop For loop Nested loops Chapter 5: Static methods • Read as soon as possible • We’ll spend some time on this Chapter 6: Arrays • No rush to read this yet • We’ll spend some time on this too Applications and Applets • A Java application is a stand-alone Java program • An applet is a Java program that can be run from a web browser, using a graphical user interface (GUI) • Application programs can also use GUIs (using AWT or Swing (better)) • Swing GUI classes all begin with J Homework (Programming Assignments) • Essential to do the homework on time • Substantial part of grade will be based on homework • First assignment will be given next week • Sometimes assignments will be multistaged • Getting help from other students is OK ONLY IF YOU DOCUMENT CLEARLY IN THE COMMENTS EXACTLY WHAT HELP YOU GOT AND FROM WHOM • See departmental policy on cheating • See me EARLY if you are having trouble Placement • Are you in the right class? • You should have had some programming experience and be eager to learn • You should not already be a Java expert! If you are, let’s talk after class. • If you’ve taken a Java course already, let’s talk after class. Eclipse • State of the art, powerful, easy to use, free • Download it and run a SHORT program before next class, and email it to me Pitfalls to watch for using Eclipse • Create ONE project the first time you use it. Adding and deleting projects is asking for trouble… • Then create ONE new class, also giving it a package name if you like.. • **** Make sure the class name starts with a Capital letter! **** • projectNames, packageNames and identifierNames should start with lowerCase • final variables (constants) should be in UPPER_CASE Running a Program • Get the syntax bugs out first – you can see immediately where the bugs are, if not how to fix them • When you run the program the first time, you have to select your ClassName from the menu that comes up: it won’t work if it does not start with a CapitalLetter! • ECLIPSE DEMO