Java Programming Fundamentals: Types, Constants, Operators, Control Structures and Arrays, Study notes of Java Programming

An introduction to various concepts in java programming, including the eight built-in types, constants, arithmetic operations, control structures (if, if/else, while, for, do-while), and arrays. It covers topics such as constants, their declaration, increment and decrement, assignment, integer and floating-point division, modulus, static methods, and relational operators.

Typology: Study notes

Pre 2010

Uploaded on 09/17/2008

david1678
david1678 🇺🇸

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 4
1. What are the 8 built in types?
- int, byte, short, long, double, float, char, Boolean.
2. What is a constant?
- A value that cannot be changed by a program. Constants are defined with the
keyword final.
3. All constants should be delcared as what access specifier and use modifier?
- public static
4. What is increment and decrement?
- increment is adding 1 and is represented by ++ , decrement is subtracting 1 and is
represented by --
5. What is assignment?
- It is not setting the left side to the right side, but rather places a value into a variable.
In Java x = x + 1 while in algebra this would make no sense.
6. How are the arithmetic operations performed?
7. What is integer division and how is it different then floating point division?
Floating point division works like normal division, there has to be a decimal involed
for example 7.0/4 = 1.75, In integer division 7/4 = 1 R3 and the R3 is discarded.
8. What is modulus?
- Modulus is an operator that computes the remainder of a division. 7 % 4 = 3.
9. What is a static method and how do you call it?
- A method that does not operate on an object.
Chapter 5
1. What is the if statement?
- a statement used to make a decision depending on a condition.
pf2

Partial preview of the text

Download Java Programming Fundamentals: Types, Constants, Operators, Control Structures and Arrays and more Study notes Java Programming in PDF only on Docsity!

Chapter 4

  1. What are the 8 built in types?
  • int, byte, short, long, double, float, char, Boolean.
  1. What is a constant?
  • A value that cannot be changed by a program. Constants are defined with the keyword final.
  1. All constants should be delcared as what access specifier and use modifier?
  • public static
  1. What is increment and decrement?
  • increment is adding 1 and is represented by ++ , decrement is subtracting 1 and is represented by --
  1. What is assignment?
  • It is not setting the left side to the right side, but rather places a value into a variable. In Java x = x + 1 while in algebra this would make no sense.
  1. How are the arithmetic operations performed?
  2. What is integer division and how is it different then floating point division? Floating point division works like normal division, there has to be a decimal involed for example 7.0/4 = 1.75, In integer division 7/4 = 1 R3 and the R3 is discarded.
  3. What is modulus?
  • Modulus is an operator that computes the remainder of a division. 7 % 4 = 3.
  1. What is a static method and how do you call it?
  • A method that does not operate on an object.

Chapter 5

  1. What is the if statement?
  • a statement used to make a decision depending on a condition.
  1. What is the if/else statement?
  2. What are the relational operators in Java?
  3. How should you compare floating point numbers?
  4. What should you never use to compare strings? Why?
  • = = because it compares the memory address.
  1. What is a Boolean expression?
  2. What are the Boolean operators and how do they work?

Chapter 6

  1. What is the while loop and how does it work?
  2. How is the while loop different from the if statement?
  3. What is a for loop?
  4. How can you take a for loop and turn it into a while a loop and vice versa?
  5. What is a do while loop and how is it different from a while loop?

Chapter 7

  1. What is an array?
  2. What is an array list?
  3. How are they the same and how are they different?
  4. What is an out of bounds error?
  5. How are arrays and array lists indexed?
  6. Is array[array.length] or arrayList.get( arrayList.size() ) allowed?
  7. What is a wrapper class?
  8. What does it mean to autobox/unbox?