Download presentation
Presentation is loading. Please wait.
1
Java Keywords CSE 115 Spring 2006
2
Purpose This set of slides contains a running list of the keywords that we have talked about so far this semester and a brief explanation of what each keyword does.
3
class (added 1/30/06) Indicates the start of the definition of a class. public class Name { }
4
new (Added 1/30/06) Indicates a call to a constructor Used when you want to create a new instance of an object Use: new constructorName();
5
package (Added 2/1/06) Indicates membership for a class in a particular package Packages correspond to directories on the file system Use: package nameOfPackage;
6
private (Added 2/3/06) Access control modifier (visibility) Only accessible from within the class
7
public (Added 2/3/06) Access control modifier (visibility) Accessible from everywhere and to everyone
8
void (Added 2/8/06) Used as a return type for a method. Indicates that the method does not return anything. public void methodName() { }
9
extends (Added 2/15/06) Indicates that the class you are writing has a superclass, which is an indication of inheritance. public class ClassName extends SuperClassName { }
10
this (Added 2/15/06) Self-reference Refers to the class itself Can be used to have the class call its own method this.methodName();
11
return (Added 2/17/06) Needed to indicate what value is being returned from a method that has a return type. public NonVoidType methodName() { //do some work return someValue; }
12
super (added 3/1/06) Indicates a call to the superclass’ method (either constructor or just a regular method). public ConstructorName() { super(param); } public void OverriddenMethod() { super.OverriddenMethod(); }
13
interface (added 3/3/06) Indicates the beginning of an interface definition. public interface InterfaceName { }
14
abstract (added 3/3/06) Indicates that a method is abstract (does not have a method body). public abstract void method(); OR abstract public void method();
15
implements (added 3/3/06) Indicates that the class you are writing implements an interface. public class Name implements InterfaceName { }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.