This is not the document you are looking for? Use the search form below to find more!

Report home > Education

My handout

0.00 (0 votes)
Document Description
document, comp, lol
File Details
Submitter
  • Name: Ray Kho
Embed Code:

Add New Comment




Related Documents

Hyperbolas

by: Vincent, 2 pages

My handout for the tutoring center. Latex.

Presentations Handout

by: angleskijezik, 10 pages

Presentations Handout

Past Perfect Handout

by: angleskijezik, 6 pages

Past Perfect Handout

my cv

by: kevin b, 1 pages

my cv

Interview and Portfolio Handout

by: Hannah Smith, 2 pages

Professional Practice- Interview and Portfolio Handout

My Snoring Solution Jaw Supporter

by: John, 5 pages

http://www.Buy-MySnoringSolution.com My Snoring Solution and other jaw supporters are evidently the most impressive of all the non-invasive stop snoring techniques. This determination is not ...

MAHAGUN MY WOODS CALL 9250468704

by: sameerfmb, 3 pages

Mahagun My Wood, Mahagun My Wood Noida, Mahagun My Wood Noida Extension, Mahagun My Wood Price, Mahagun New Project, Mahagun Noida Extension, Mahagun Builder, New Project at Noida Extension

Mahagun My Woods Noida Extn Project – 09999684905 – Mahagun

by: affiso, 4 pages

Mahagun My Woods Noida Extn Project Mahagun has come up with new residential apartments by the name of Mahagun My Woods in Noida Extension. Mahagun My Woods Offers 2/3 and 4 bedroom apartments with ...

How Do I Get My Ex Boyfriend Back

by: adfwuk, 11 pages

How do I get my ex boyfriend back, those word play in your mind when you are desperate to get your ex back, if your life has been falling apart you need to read this article.

IIDX - She is My Wife (Piano Sheet)

by: Ben, 4 pages

This is piano sheet music for the song "She is my wife" on the arcade game IIDX - Beatmania

Content Preview
1

Table of Contents
[0] ............................................................................................................................ 2
[1] Chapter 1: Hello World!..................................................................................... 3
[2] Chapter 2: Skeleton............................................................................................ 4
[3] Chapter 3: Variable Declaration.......................................................................... 5
[4] Chapter 4: Public, Private and Final................................................................... 6
[5] Chapter 5: Casting.............................................................................................. 7
[6] Chapter 6: Debugging and Method Calling........................................................ 8
[7] Chapter 7: Importing Scanner............................................................................. 10
[8] Chapter 8: Working with Methods...................................................................... 11
[9] Chapter 9: If Statements..................................................................................... 12
[10] Chapter 10: Nested If Statements....................................................................... 13
[11] Chapter 11: While Loops.................................................................................... 14
[12] Chapter 12: For Loops and Arrays...................................................................... 15
[13] Chapter 13: Double Arrays................................................................................. 16
[14] Chapter 14: Objects............................................................................................ 17
[15] Chapter 15: Recursion........................................................................................ 19
[16] Chapter 16: ArrayList and Iterator...................................................................... 21
[17] Chapter 17: Exceptions....................................................................................... 22
2

Chapter 1: Hello World!
public class HelloWorld {
public static void main (String args[]){
System.out.println("Hello World");
}
}
3

Chapter 2: Skeleton
public class Skeleton {
// GLOBAL VARIABLES
// integer that is public to all classes
public int publicInteger;
// integer that is only accessible to this particular class
private int privateInteger;
// integer that is only accessible to this particular class but is static (explained later)
private static int staticInteger;
// the final declaration declares a constant
final static int constant;
// this format must always be followed (but args can be anything)
public static void main (String args[]){
// Statements
}
// METHODS
// ALWAYS declare a method private or public; however Java implicitly declares
static int returnFive () {
return 5;
}
// Can only be accessed from this class - does not work with the this. operator
private static double returnFour() {
return 4;
}
// Can be accessed from any class - works with the this. operator
public double returnThree() {
return 3;
}
}
4

Chapter 3: Variable Declaration
public class DeclaringVariables {
public static void main (String args[]){
// Note that short, ints and longs are similar, but shorts store the least amount of
//information, ints a little more, and longs the most
// They are all, however, stored as integers.
short myFirstShort = 1;
int myFirstInteger = 1;
long myFirstLong;
myFirstLong = 2;
// These are decimal point delcarations
double myFirstDouble = 2;
float myFirstFloat = 3;
// Booleans are true or false statements
boolean isThisTrue = true;
// Characters just store a simple character. They must be declared in single
//quotations.
// Double quotes refer to a String
char theLetterA = 'a';
}
}
5

Chapter 4: Public, Private and Final
public class VariableFun {
static double a = 1;
double b = 2;
public static double c = 3;
private double d = 4;
private static double e = 5;
final static double f = 6;
public final static double g = 7;
public static void main (String args[]){
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
System.out.println(f);
System.out.println(g);
a = 10;
b = 20;
c = 30;
d = 40;
e = 50;
f = 60;
g = 70;
System.out.println("a");
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
System.out.println(f);
System.out.println(g);
// This program will NOT compile. Why?
// What would this program print out if we were to remove the errors?
}
}
6

Chapter 5: Casting
public class CastingFun {
public static void main (String notargs[]) {
double pi = 3.14;
int pie = (int) pi;
System.out.print(pi);
System.out.println(pie);
pie = 5;
pi = pie;
System.out.println(pi);
// Does this program compile?
// What does it print?
}
}
7

Chapter 6: Debugging and Method Calling
//This program has three errors
//We will debug it together so that you understand what is happening.
public class EvilPrimitives {
public static int one = 1;
public static int two;
public static int three = 3;
private static int four = 4;
public static int five = 5;
public static int eight = 8;
public static void main (String args[]) {
int six = 6;
five = confusion(five);
two = confusion2();
seven = 700;
Changer.changer1(six);
Changer.changer2(one);
Changer.changer3();
four = 400;
// What gets printed and what doesn't?
System.out.println(one);
System.out.println(two);
System.out.println(three);
System.out.println(four);
System.out.println(five);
System.out.println(six);
System.out.println(seven);
}
public static void confusion (int integer) {
int seven = 7;
return;
}
public static int confusion2() {
two = 2;
return 5;
}
}
8

//This program has three errors, one of which is a logical error
public class Changer {
public static int changer1 (int integer){
six = 600;
integer = 600;
EvilPrimitives.eight = 600;
}
public static int changer2 (int integer) {
EvilPrimitives.one = 100;
}
private void static changer3 () {
EvilPrimitives.three = 300;
return;
}
}
9

Chapter 7: Importing Scanner
// One error here
import java.util.Scanner;
public class ReadFromKeyboard {
public static void main (String heyguys[]) {
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
double j = sc.nextInt();
double k = sc.nextInt();
int l = sc.nextDouble();
System.out.println(i);
System.out.println(j);
System.out.println(k);
System.out.println(l);
}
}
10

Download
My handout

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share My handout to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share My handout as:

From:

To:

Share My handout.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share My handout as:

Copy html code above and paste to your web page.

loading