Chapter 1 -getting started Flashcards

1
Q

ideology of OOP

A

views a program as consisting of objects that interact with one another by means of actions called methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

objects of the same kind are said to have the same…

A

type or be in the same class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Applications vs applets

A
application - regular program is a class that has a method named main 
when its is run, the run-time system automatically invokes the main method 

applet - application meant to be run from a web browserO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Obj used to sending output to screen

A

System.out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is println

A

method or action that the System.out obj performs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

=

A

assignment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

==

A

are these two things in the same memory location?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

.equals()

A

are these things the same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

define source code

A

program written in a high level language - input to the compiler program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

object code

A

translated low level language program

output from the compiler program e.g. Java byte code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what does javac do?

A

Each class is compiled with the command javac followed by the name of the file in while the class resides. The result is a byte code program whose filename is the sa,e as the class name followed by .class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

syntax vs semantics

A

syntax - like the grammar, semantics - meaning of the things written while following the syntax rules of a language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Syntax error vs run time error vs logic error

A

syntax - code wont compile
run time - error that isnt detected until the program is run
logic error - mistake in the algorithm for a program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

case sensitive

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

keywords and reserved words

A
public class void static 
System String println - predefined in libararies can be changed but dangerous
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

declaring more than one variable at a time

A

double one, two, three;

17
Q

primitive data types

A
boolean
char - 2 bytes
byte
short
int
long
float
double
18
Q

initializing variables

A

int initial = 50, finalcount;

19
Q

shorthand

A

count +=2 - count = count+2

amount =count1+count2 –> amount = amount(count1+count2)

20
Q

assignment compatibility

A

int intvar = 2.99 - illegal
exceptions:
int can go into a double

21
Q

auto type casting hierarchy

A

byte - short - int - long - float - double

22
Q

from a float to int

A

truncation - 2.9 – 3

23
Q

type coercion -

A

auto type cast

24
Q

explicit type cast

A

int i = (int) 5.5

25
arithmetic between int-int and int-double
int -int = ans will be int | int-double - double
26
round off errors
15.0/2 = 7.5 | 15/2=2 - truncation
27
increment and decrement
++ | --
28
pre vs post decrements
pre: if n = 2: 2*++n = 6 post if n = 2: 2*n++ = n = 4...n is first assigned and then incremented
29
the string objects
no primitive types String a = "hello" concatination
30
define a class
the name for a type whose values are objects
31
what is an object
entities that store data and take actions
32
Some string methods
``` .length() .equals() equalsIgnoreCase() .toLowerCase() .toUpperCase() .trim() charAt(position) substring(start) substring(start,end) indexOf() ```
33
escape sequences
basically just use \
34
ascii vs unicode
ascii - contains all the characters used on an english keyboard unicode - incl ascii plus other language characters
35
program documentation
- javadoc | - extract documemntation from block comments in the classes that you define = /**