Syntax

Java Extend a Class Syntax

In Java, extend a class: inherits from another class — class Puppy extends Dog { ... }

Quick Answer

Syntax
class Puppy extends Dog { ... }
JavaSyntax

Extend a Class

Code example
class Puppy extends Dog { ... }

Inherits from another class.

Learn More

How to extend a class in Java

  1. Open your Java file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Java Extend a Class Syntax

Use class Puppy extends Dog { ... }.

Related Syntax References

Frequently asked questions

What is the Java syntax for extend a class?

Use this pattern: class Puppy extends Dog { ... }

Can I copy this Java code example?

Yes. Use Copy code and adapt the example to your program.

Is this Java syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify