Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

[an error occurred while processing this directive]

Java: Summary - Basic Elements

Comments

// Everything to the end of the line is ignored. Use for most comments.
/* Everything (possibly many lines) is ignored until a */. Uncommon. Use for commenting out code.
/** Used for automatic HTML documentation generation by the javadoc program. */

Identifier Names

  • Start identifiers with an alphabetic character (a-z or A-Z), and continue with alphabetic, numeric (0-9), or '_' (underscore) characters. Do not use $.
  • Second words in a name should start with an uppercase letter.
  • Do not use keywords (see below).
  • Class and interface names should start with an uppercase letter (Graphics, ActionListener, JButton, ...)
  • Variable and method names should start with a lowercase letter (repaint(), x, ...).
  • Constants should be all uppercase with underscores between words (BoxLayout.X_AXIS, Math.PI, ...).

Keywords

The keywords are divided into three categories by expected student usage. Maybe try, catch, and assert are more common.

CategoryVery commonLess CommonUncommon
Primitive Types boolean char double int true false byte float short long
Control Flow if else while for switch case break default return assert do try catch continue finally throw synchronized
OOP class extends implements new null this enum interface super instanceof
Declarations public private import package static final void throws protected transient volatile native
Other strictfp goto const

Variables - Local, Instance, Class

Variables may be local, instance (field), or static (class) variables. Formal parameters are local variables that are assigned values when the method is called.
local instance static / class
Where declared In a method. In class, but not in a method. In class using static keyword.
Initial value Must assign a value before using. Compiler error if you don't. Zero for numbers, null for objects, false for boolean. Or initialized in constructor. Zero/null/false or initialized in static initializer.
Visibility Only in the same method. No visibility may be declared. private: Only methods in this class. Default: All methods in same package. public: Anyone can see it. protected: This class and all subclasses can see it. Same as instance.
When created When method is entered. When an instance of the class (object) is created with new. When program is loaded.
Where in memory Call stack. Heap. "Permanent" memory.
When destroyed When the method returns. When there are no more references to the object. When program terminates.

Copyright 2005 Fred Swartz
Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

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

Copyright © 2007. All rights reserved.