| COBOL | Java |
|---|---|
*> Accessibility keywords *>public *>private *>internal *>protected *>protected internal *>static class-id Competition. end class. *> Inheritance class-id FootballGame inherits type Competition. end class. *> Interface definition interface-id IClock. end interface. interface-id ITimer. end interface. *> Extending an interface interface-id IAlarmClock inherits type IClock. end interface. *> Interface implementation class-id WristWatch implements type IAlarmClock, type ITimer. end class. |
//Accessibility keywords
public
private
// The closest counterpart to .NET's "internal" is specified
// by ommitting the visibility keyword, though this "default"
// visibility has some behavior differences.
protected
static
// Inheritance
class FootballGame extends Competition
{
...
}
// Interface definition
interface IAlarmClock
{
...
}
// Extending an interface
interface IAlarmClock extends IClock
{
...
}
// Interface implementation
class WristWatch implements IAlarmClock, ITimer
{
...
}
|
Portions of these examples were produced by Dr. Frank McCown, Harding University Computer Science Dept, and are licensed under a Creative Commons License.