Java Course Review.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Copyright 2006 by Pearson Education 1 reading: 4.1 Cumulative sum.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
Chapter 3 Using Classes and Objects. 2 Creating Objects  A variable holds either a primitive type or a reference to an object  A class name can be used.
Review Java.
Applying OO Concepts Using Java. In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Hello AP Computer Science!. What are some of the things that you have used computers for?
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Chapter 2 How to Compile and Execute a Simple Program.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
The Java Programming Language
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.
Chapter 2 Input, Variables and Data Types. JAVA Input JAVA input is not straightforward and is different depending on the JAVA environment that you are.
CIS 234: Java Methods Dr. Ralph D. Westfall April, 2010.
By Mr. Muhammad Pervez Akhtar
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
Java: Variables and Methods By Joshua Li Created for the allAboutJavaClasses wikispace.
1 BUILDING JAVA PROGRAMS CHAPTER 5 PROGRAM LOGIC AND INDEFINITE LOOPS.
CSII Final Review. How many bits are in a byte? 8.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Introduction to Java Import Scanner class to use in our program
John Woodward A Simple Program – Hello world
JAVA MULTIPLE CHOICE QUESTION.
Java Applet Programming Barry Sosinsky Valda Hilley
Chapter 3 GC 101 Java Fundamentals.
Introduction to.
Yanal Alahmad Java Workshop Yanal Alahmad
Building Java Programs
Primitive Data, Variables, Loops (Maybe)
Programming Language Concepts (CIS 635)
JavaScript: Functions.
Repetition.
Counted Loops.
An Introduction to Java – Part I
Introduction to javadoc
CS139 – Fall 2010 How far we have come
Java Programming with BlueJ
An Introduction to Java – Part I, language basics
Differences between Java and JavaScript
Introduction to javadoc
Introduction to Java Brief history of Java Sample Java Program
Building Java Programs
Chap 1. Getting Started Objectives
A Methodical Approach to Methods
Chap 4. Programming Fundamentals
Computer Programming-1 CSC 111
Methods/Functions.
Presentation transcript:

Java Course Review

Java Course Review What is Java? An object-oriented programming language developed by Sun Microsystems Consists of a Java Virtual Machine, which runs java byte code files (.class files) Also, a java compiler, which converts .java files into .class files

Java Course Review What types of variables used in java? int double String JLabel What are 3 variable naming no no’s?

Java Course Review Java classes Each java program is a class that contains a main method where the program starts running A constructor can be defined which will get called when an instance of the class is created Methods are called by using the name of the method followed by the () and inside any _______________ needed to be passed to the method

Java Course Review Java naming conventions Java classes are named using ____________________ A class defining a circle would be spelled______ An object is a specific instance of a class 3 objects of the circle class could be spelled c1, c2 and c3

Java Course Review Import statements What do import statements accomplish? What is a typical import statement we have used?

Java Course Review Printing to the console window What are the two commands to print stuff to the console window?? Write a method called output10 that loops and prints out the numbers 1-10 on separate lines Write a method called output10NoLineBreaks that prints out the numbers -1 to -10 on the SAME line separated by a space

Java Course Review Methods Methods are subprograms that can can be called by using the name of the method and the () Example public void printReport() { System.out.println(“Daily Report for Salon”); System.out.println(“Number of Customers”); …more commands here } To activate or call the above method, use…

Java Course Review Methods cont’d Methods can also have _____________ or variables in the parentheses of the method that act as inputs to the method Parameters can help a programmer create powerful, reusable methods

Java Course Review For example To find the area of any triangle public double area(double len, double height) { return .5*len*height; } //To call this method and find the area of a 12 length by 4.5 h triangle and print it use…

Java Course Review Looping Allows a programmer to repeat commands a certain number of times Typical loop format Set control var while(condition){ //take some action Increment control variable }

Java Course Review Looping – cont’d How many times will the following loop get executed? int i = 5; while(i<0){ System.out.println(“I am in the loop”); i++; } How about this one? int i = 0; while(i<8){ System.out.print(i*i);

Java Course Review Logical Operators Logical AND Logical OR Logical Negation What is the value of (5!=3)&&(4<8|| 1>0)? ((!(3>=3))&&(1<5))? !(-1>0)?

Java Course Review Mathematical Operators + - / double / integer * %

Java Course Review Scope of variables Describe the scope of; Globals Local variables Parameters

Java Course Review Arrays Arrays are collections of variables of the same type, grouped under a single name. Array sizes are _________ at the time an array is created with the new command In order to utilize an array, use a subscript inside the [ ] ‘s.

Java Course Review Arrays – cont’d Use an array to store 5 different randomly generated integers between 1 and 1000. You may assume that java.util.* has been imported public static void main(String[] args) { Random r = new Random(); int[ ] nums = new int[5]; for (int i=0; i<5; i++) { nums[i] = r.nextInt(1000)+1; }

Java Course Review java.util.Random Random r = new Random(); What is the range of r.nextInt(5)? What is the range of r.nextInt(10)? What is the range of r.nextInt(3)+1?

Java Course Review Java applets Although we didn’t have time to cover java applets in this class, they are special java programs that contain an init() and run() method that can be run from within a browser Applets can run from a web page but have certain limitations for security reasons (can’t write to the local hard disk or open any new network connections)

Java Course Review Object Oriented Programming Java is designed for oo programming This means that once a class is defined, another class can utilize that class by making an instance of the first class inside its code OO programming allows us to reuse existing logic from programs in other programs which saves time and money

Java Course Review Remember to review your glossary terms for the final exam

Java Course Review