Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Static/Class methods

Static methods use no instance variables of any object of the class they are defined in.

Tutorial Details:

There are two types of methods.

Instance methods are associated with an object and use the instance variables of that object. This is the default.

Static methods use no instance variables of any object of the class they are defined in. If you define a method to be static, you will be given a rude message by the compiler if you try to access any instance variables. You can access static variables, but except for constants, this is unusual. Static methods typically take all they data from parameters and compute something from those parameters, with no reference to variables. This is typical of methods which do some kind of generic calculation. A good example of this are the many utility methods in the predefined Math class.


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/flow/methods/50static-methods.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Static/Class methods

View Tutorial:
Static/Class methods

Related Tutorials:

Java Tip 65: Measure data transfer speeds via Sun's ORB in JDK 1.2 beta 4 - JavaWorld - January 1999
Java Tip 65: Measure data transfer speeds via Sun's ORB in JDK 1.2 beta 4 - JavaWorld - January 1999
 
Java Tip 70: Create objects from jar files! - JavaWorld - March 1999
Java Tip 70: Create objects from jar files! - JavaWorld - March 1999
 
Programming Java threads in the real world, Part 3 - JavaWorld - November 1998
Programming Java threads in the real world, Part 3 - JavaWorld - November 1998
 
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
 
How to easily reconfigure your applications -- while they're running - JavaWorld - April 1999
How to easily reconfigure your applications -- while they're running - JavaWorld - April 1999
 
Static class declarations
Static class declarations
 
Secure thread collaboration across protection domains - JavaWorld December 2000
Secure thread collaboration across protection domains - JavaWorld December 2000
 
When is a Singleton not a Singleton? - JavaWorld January 2001
When is a Singleton not a Singleton? - JavaWorld January 2001
 
Browse user interfaces for Jini services - JavaWorld March 2001
Browse user interfaces for Jini services - JavaWorld March 2001
 
Study guide Achieve strong performance with threads Part 1
Study guide Achieve strong performance with threads Part 1
 
Create your own type 3 JDBC driver, Part 3
Create your own type 3 JDBC driver, Part 3
 
Java Tip 130: Do you know your data size?
Java Tip 130: Do you know your data size?
 
Good article
Good article
 
Good, but obsolete
Good, but obsolete
 
Object equality
Object equality Writing equals and hashCode methods for data objects Summary In this article, Alex Blewitt describes the two most common methods in the Java language—equals() and hashCode()—and shows how they can be implemented correctly. The
 
Smokescreen Introduction
Smokescreen is a Java obfuscator. Aside from being able to change symbolic names, it can also modify the bytecode instructions in methods thereby obfuscating control flow. This makes the resulting obfuscated classes much more difficult to decompile.
 
Smokescreen 3.4 has been released
Smokescreen is a Java obfuscator. Aside from being able to change symbolic names, it can also modify the bytecode instructions in methods thereby obfuscating control flow. This makes the resulting obfuscated classes much more difficult to decompile.
 
JTwain
JTwain will implement a Java interface to the the Win32 C DLL TWAIN acquire methods.
 
ClassRemoter
ClassRemoter is a remote class wrapper generator for use with RMI. It can create remote wrappers for existing java classes and interfaces, that would not normally be used with RMI. The wrappers may then be used to access the public methods.
 
Parsing an XML Document with XPath
The getter methods in the org.w3c.dom package API are commonly used to parse an XML document. But J2SE 5.0 also provides the javax.xml.xpath package to parse an XML document with the XML Path Language (XPath) .
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.