List of Java keywords: Difference between revisions

Content deleted Content added
combine various excessively short (and related) paragraphs together
rewrite/add references for all keywords relating to class member access (and also const keyword)
Line 3:
In the [[Java (programming language)|Java programming language]], a '''keyword''' is one of 50 [[reserved word]]s which have a predefined meaning in the language; because of this, programmers cannot use keywords as names for [[variable#Computer programming|variables]], [[method (computer science)|methods]], [[class (computer science)|classes]], or as any other [[identifier]].<ref name="keywords">{{cite web |title=Java Language Keywords |url=http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html |work=The Java Tutorials |publisher=[[Sun Microsystems, Inc.]] |date=February 14, 2008 |accessdate=2008-12-02}}</ref> Due to their special functions in the language, most [[integrated development environment]]s for Java use [[syntax highlighting]] to display keywords in a different color for easy identification.{{fact}}
 
The following is a list of the keywords in Java, along with a brief descriptiondescriptions of their functions:<ref name="keywords" />
 
;<code>[[Abstract class|abstract]]</code>
Line 32:
:A type that defines the implementation of a particular kind of object. A class definition defines [[Object (computer science)|instance]] and class fields, [[Method (computer science)|methods]], and [[inner class]]es as well as specifying the [[Interface (computer science)|interfaces]] the class implements and the immediate [[Superclass (computer science)|superclass]] of the class. If the superclass is not explicitly specified, the superclass is implicitly {{Javadoc:SE|java/lang|Object}}.
 
;<code>[[Variable#Constant|const]]</code> (reserved without use)
:Although reserved as a keyword in Java, <code>const</code> is not used and has no function.<ref name="keywords" />
:This keyword is '''not used''' by current versions of the Java programming language.
 
;<code>[[continue (Java)|continue]]</code>
Line 105:
 
;<code>[[Java_syntax#Class_member_access|private]]</code>
:The <code>private</code> keyword is used in the declaration of a method, field, or inner class; private members can only be accessed by other members of its own class.<ref name="access">{{cite web |title=Controlling Access to Members of a Class |url=http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html |work=The Java Tutorials |publisher=Sun Microsystems, Inc. |date=February 14, 2008 |accessdate=2008-12-03}}</ref>
:An access modifier used in a method, field or inner class declaration. It signifies that the member can only be accessed by other elements of its class.
 
;<code>[[Java_syntax#Class_member_access|protected]]</code>
:AnThe access<code>protected</code> modifierkeyword is used in the declaration of a method, field, or inner class; declaration. It signifies that theprotected membermembers can only be accessed by elementsmembers residingof inits itsown class, subclasses, or classesthat inclass's the[[inheritance same(object-oriented packageprogramming)|subclasses]].<ref name="access" />
 
;<code>[[Java_syntax#Class_member_access|public]]</code>
:AnThe access<code>public</code> modifierkeyword is used in the declaration of a class, method, or field; declaration.public Itclasses, signifies that the classmethods, methodand or variablefields can be accessed by elementsthe residingmembers inof any other classes or packagesclass. All members declared in an <code>interface</code>ref arename="access" implicitly <code>public</code>.
 
;<code>[[Method (computer science)|return]]</code>