Object Oriented Software Engineering   View all facts   Glossary   Help
subject > component > module > Java module > Java method
Next Java moduleJava package    UpJava module, method    Previous Java moduleJava class   

Java method comparison table
Subject refer to wait until have default implementation call by have is part of is a kind of is a subtopic of have example overuse have return type is an instance of have purpose access by have arguments has part have result mark as declare used in contain create by write for
equals method    a comment at its head if the method is non-obvious  The Basics of Java
 boolean b = aPostalCode.equals(anotherPostalCode);
  Java methodto test whether two objects are equal i.e. they contain the same data, but are not necessarily the same objectother methods and variables in any class in the same package by default         
Java abstract method    a comment at its head if the method is non-obvious Java methodThe Basics of Java    to serve as a placeholder, indicating that subclasses must have concrete implementationsother methods and variables in any class in the same package by default      any executable statements in its bodylabelling it with the keyword abstract 
Java class method   using the name of the class, followed by a dot, followed by the name of the method (the name of the class can be omitted when calling a class method in the current class)'this' value when it is executing Java methodThe Basics of Java    implementing functions such as initializing a class, or operating on the complete set of instances of a classother methods and variables in any class in the same package by default   static     
Java constructor    the same name as its classa classJava methodThe Basics of Java
public Account(String accountHolder, float initialBalance)
{
this.accountHolder = accountHolder;
balance = initialBalance;
opened = new Date();
}
public Account(String accountHolder)
{
this.accountHolder = accountHolder;
balance =0.0;
opened = new Date();
}
   to initialize the instance variables of a newly created object and perform any other needed initializationother methods and variables in any class in the same package by default         
Java instance methodthe object itself using the 'this' keyword   a comment at its head if the method is non-obvious Java methodThe Basics of Java
public float credit(float amountToCredit)
{
balance = balance + amountToCredit;
return balance;
}
 void if it does not return anything  other methods and variables in any class in the same package by default return type  public, protected or private    
println    a comment at its head if the method is non-obvious  The Basics of Java
System.out.println("This line will be printed");
  Java method other methods and variables in any class in the same package by default         
private method    a comment at its head if the method is non-obvious Java methodThe Basics of Java     code in the same class         
protected method    a comment at its head if the method is non-obvious Java methodThe Basics of Java     code in the same package as this class as well as code in any subclasses, even if they are not in the same package         
public method    a comment at its head if the method is non-obvious Java methodThe Basics of Java     any code anywhere         
readObject an object is received over the socket, or until an I/O error occurs, which will happen if the program at the other end of the connection is terminated  a comment at its head if the method is non-obvious  3.5 - Technology Needed to Build Client-Server Systems   Java method other methods and variables in any class in the same package by default     client-server systems   
substring    a comment at its head if the method is non-obvious  The Basics of Java
 String sub = "submariner".substring(0,3);  // = "sub"
  Java methodto extract part of a stringother methods and variables in any class in the same package by defaultstarting position and ending position + 1 a new String with a sequence of characters from the original string      
toString  the name of the class followed by a hexadecimal code that distinguishes one instance from another a comment at its head if the method is non-obvious  The Basics of Java   Java methodto convert any kind of object into a stringother methods and variables in any class in the same package by default        every class you create

Next Java moduleJava package    UpJava module, method    Previous Java moduleJava class