Java   View all facts   Glossary   Help
object
Next kbTopobject table    UpkbTop    Previous kbTopname space   

object comparison table
Subject pause consist of declare terminate is a subtopic of create you concatenate you have length create block see also run concurrently with represent contain have purpose is a synonym of support by have example belong to have value stop permanently avoid refer to by manipulate allow have example of creation use be not have return has definition compose of throw when initialize to be is partitioned into
array  using an array declaration Arraysuse the new operator stored in the instance variable lengthusing the new operator   
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviour    
//the following sums all the elements of an integer array:
for(int i = 0; i < anIntArray.length; i++)
{
sum += anIntArray[i];
}
   if you do not know beforehand the number of items it will containseveral different variables at the same timecollections of objects 
//Create an array called numbers containing 4 integers
int numbers;
numbers = new int [4];
//Or create the array combining the two statements into one
int numbers [] = new int [4];
//Or create the array and initialize it too
int numbers [] = {1, 2, 3, 4};
  a type which is the type of every data item in the arrayits class using the getClass methodA collection of data items that are all of the same type, in which each item's position is uniquely designated by an integerprimitive types or instances of classes default values if it is created using new an instance of a class which you can subclass or for which you can write your own code 
current object    Objectsuse the new operator      
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviour         the keyword this  String name = new String();  state that is maintained in its variablesits class using the getClass methodThe object whose method is currently being called   distinct from every other object even if they contain the same data 
exception    Exception Handlinguse the new operator    Exception class any entity to which you can associate properties and behaviour         several different variables at the same time  String name = new String();  state that is maintained in its variablesits class using the getClass methodAn event that happens during program execution that prevents the program from continuing normally; generally, an error something goes wrong in the execution of a program distinct from every other object even if they contain the same dataunchecked exception, checked exception
GUI event object    Graphical User Interfacesuse the new operator      
  • when an object is not needed any longer
  • the object's space is garbage collected
an action of the user         several different variables at the same time  String name = new String();  state that is maintained in its variablesits class using the getClass methodA common object used in GUI window systems to represent the action of a user pressing a mouse button or a key on the keyboard   distinct from every other object even if they contain the same data 
instance of wrapper class    Objectsuse the new operator    wrapper class 
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviouran instance variable of the corresponding primitive data type        several different variables at the same time  String name = new String();methods instead of ordinary arithmetic or logical operators state that is maintained in its variablesits class using the getClass method    distinct from every other object even if they contain the same data 
string a collection of characters  Variables and Data Typesuse the new operatoruse the + operator   String class 
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviour         several different variables at the same time access to its characters using the charAt method as in:
stringName.charAt(index)
String name = new String(); an array of characters like in C and C++zero-based indexingthe number of characters it contains using the length() method as in:
stringName.length()
    an instance of the String class 
threadfor a specific amount of time using the sleep method  when it has finished its jobThreads
  1. Create a class to contain the code that will control the thread. This can be made a subclass of Thread class, or else it can implement the interface Runnable.
  2. Write a method called run in your class. The run method will normally take a reasonably long time to execute - perhaps it waits for input in a loop. When the thread is started, this run method executes, concurrently with any other thread in the system. When the run method ends, the thread terminates
  3. Create an instance of Thread class, or your subclass of Thread class, and invoking the start operation on this instance. If you implemented the interface Runnable, you have to pass an instance of your class to the constructor of Thread class.
   if it is waiting for or executing another function or thread that is blockedThread class1 or more other threads
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviour to perform a job such as waiting for events or performing a time-consuming job that the program doesn't need to complete before going onlightweight processmany operating systems and programming languages
public class ThreadExample implements Runnable
{
private int counterNumber; // Identifies the thread
private int counter; // How far the thread has executed
private int limit; // Where counter will stop
private long delay; // Pause in execution of thread in milisecs

// Constructor
private ThreadExample(int countTo, int number, long delay)
{
counter = 0;
limit = countTo;
counterNumber = number;
this.delay = delay;
}

//The run method; when this finishes, the thread terminates
public void run()
{
try
{
while (counter <= limit)
{
System.out.println("Counter "
+ counterNumber + " is now at " + counter++);
Thread.sleep(delay);
}
}
catch(InterruptedException e) {}
}

// The main method: Executed when the program is started
public static void main(String[] args)

//Create 3 threads and run them
Thread firstThread = new Thread(new ThreadExample(5, 1, 66));
Thread secondThread = new Thread(new ThreadExample(5, 2, 45));
Thread thirdThread = new Thread(new ThreadExample(5, 3, 80));

firstThread.start();
secondThread.start();
thirdThread.start();
}
}
a thread group which places limitations on the thread to protect it from other threads when its run method returns several different variables at the same time  String name = new String();  thread priorityits class using the getClass methodAn object used in multithreaded software systems that represents a sequence of program execution   distinct from every other object even if they contain the same data 
uninitialized object    Objectsuse the new operator      
  • when an object is not needed any longer
  • the object's space is garbage collected
any entity to which you can associate properties and behaviour      null  several different variables at the same time  String name = new String();  state that is maintained in its variablesits class using the getClass methodAn object that has been declared but has not been assigned a value   distinct from every other object even if they contain the same data 

Next kbTopobject table    UpkbTop    Previous kbTopname space