• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/20

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

20 Cards in this Set

  • Front
  • Back
variable scope
The scope of a variable is the part of the program over which the variable name can be referenced.
Refers to the accessibility of a variable. You cannot refer to a variable before its declaration.
Where can variables be declared?

You can declare variables:

1. In a class body as class fields. Variables declared here are referred to as class-level variables.
2. As parameters of a method or constructor.
3. In a method's body or a constructor's body.
4. Within a statement block, such as inside a while or for block.
Variable scope rule 1.
The rule 1 is that variables defined in a block are only accessible from within the block. The scope of the variable is the block in which it is defined.
Variable scope rule 2.

Variables declared as method parameters can be accessed from within the method body. Class-level variables are accessible from anywhere in the class.



Variable scope rule 3.
If a method declares a local variable that has the same name as a class-level variable, the former will 'shadow' the latter. To access the class-level variable from inside the method body, use the this keyword.
Java class structure
A Java class has fields and methods. The methods are the behaviors of the class. methods are constructors and other methods.
Platform independence
So, the byte code is platform independent but the interpreted code is machine-specific and will execute on the environment the JVM is installed on. JAVA programs are platform-independant means that JAVA is platform independant. Sun MicroSystems slogan was WORA: Write Once Run Anywhere
class
A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object.
object

An object is a software bundle of related state and behavior.


Characteristics of objects:


* State (what the objects have)
* Behavior (what the objects do)
* Identity (what makes them unique)

Inheritance



Inheritance provides a powerful and natural mechanism for organizing and structuring your software. This section explains how classes inherit state and behavior from their superclasses, and explains how to derive one class from another using the simple syntax provided by the Java programming language.

interface
An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface. This section defines a simple interface and explains the necessary changes for any class that implements it.
package
A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage. This section explains why this is useful, and introduces you to the Application Programming Interface (API) provided by the Java platform.
Encapsulation
Encapsulation is one of the four fundamental OOP concepts.Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class.
Object Oriented Programming Fundamentals


1. Abstraction


2. Encapsulation


3. Inheritance


4. Polymorphism



Abstraction
Object oriented programming Abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words user will have the information on what the object does instead of how it does it.

In Java Abstraction is achieved using Abstract classes, and Interfaces.

Polymorphism
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
Java data types

1. Primitive data types


2. Reference/Object types

instance variable
An instance variable is a variable that belongs to the instance of an
object (opposed to class variables).
reference variable
A reference varaible, points to
an object. A reference variable can however also be an instance member.