Java View all facts Glossary Help |
syntactic unit > declaration |
declaration comparison table |
Subject | define | have syntax | terminate by | be | is a kind of | is a synonym of | is a subtopic of | have example | place | occur | create | locate | have purpose | import | be part of | has definition | declare | contain | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
array declaration | square brackets following the type | declaration | Arrays | int[] anIntArray = new int[25]; | definition | ||||||||||||||
class declaration |
| public abstract final class nameOfClass extends Super implements Interfaces | declaration | Classes | public class HelloWorld | to specify the class | definition | A declaration that specifies a class and does not include the class body | the class name | ||||||||||
import statement | import packageName.* | a semicolon | not more than one line long if possible | statement | import declaration | Packages | //Import the Circle class from the graphics package |
| to allow a class to use the facilities of another package | 1 member class of a package or imports on demand 0 or more member classes from a package | definition | A statement that permits using references to other packages without prefixes | |||||||
interface declaration | public interface interfaceName extends superInterfaces | declaration | Interfaces | public class AnimatedSign extends javax.swing.JApplet | to declare an interface | 1 interface definition | |||||||||||||
method declaration | the method | accessLevel static abstract final native synchronized returnType methodName (parameterList) throws exceptions | declaration | Methods | int[] makeRange(int lower, int upper) | to declare a method | definition | ||||||||||||
object declaration | type namewhere type may be the name of a class or an interface | declaration | Objects | Rectangle rect; | a new object | to declare an object, without actually creating it | definition | ||||||||||||
package statement | package packageName | a semicolon | the first statement in the source file except for comments | statement | package declaration | Packages | package com.naviseek.canasta | at the beginning of a file | to specify the name of the package to which the compilation unit in which the package declaration is put belongs | definition | A statement that declares the name of the package the file defines | package information about the class in the source file | |||||||
parameter declaration | type parameterName | declaration | Variables and Data Types | to declare a parameter | definition | ||||||||||||||
variable declaration | accessLevel static final transient volatile type variableName | declaration | Variables and Data Types | Rectangle rect = new Rectangle(); | practically anywhere in Java source code although it is good practice to only declare variables at the beginning of blocks | to declare a variable | definition | the type name and the variable name |
Next syntactic unit: definition Up: syntactic unit Previous syntactic unit: comment