Which of the following statements declares salaried as a subclass of paytype?
Java Inheritence and Recursion Study Guide 0 ratings0% found this document useful (0 votes) 579 views9 pagesDocument Informationclick to expand document information
Study Guide for Java Test Recursion Copyright© Attribution Non-Commercial (BY-NC) Available FormatsDOCX, PDF, TXT or read online from Scribd Share this documentShare or Embed DocumentSharing Options
Did you find this document useful?0%0% found this document useful, Mark this document as useful 0%0% found this document not useful, Mark this document as not useful Is this content inappropriate?Report this DocumentDownload now SaveSave Java Inheritence and Recursion Study Guide For Later 0 ratings0% found this document useful (0 votes) Java Inheritence and Recursion Study Guide Uploaded byJava OOP
Study Guide for Java Test Recursion Full descriptionSaveSave Java Inheritence and Recursion Study Guide For Later 0%0% found this document useful, Mark this document as useful 0%0% found this document not useful, Mark this document as not useful EmbedShare PrintDownload now Jump to Page You are on page 1of 9Search inside document You're Reading a Free Preview Buy the Full Version Reward Your CuriosityEverything you want to read. Anytime. Anywhere. Any device. No Commitment. Cancel anytime. Share this documentShare or Embed DocumentSharing Options
Home Books Audiobooks Documents 1 public class Test { 2 public static void main(String[] args) { 3 Integer[] list1 = {12, 24, 55, 1}; 4 Double[] list2 = {12.4, 24.0, 55.2, 1.0}; 5 int[] list3 = {1, 2, 3}; 6 printArray(list1); 7 printArray(list2); 8 printArray(list3); 9 } 10 11 public static void printArray(Object[] list) { 12 for (Object o: list) 13 System.out.print(o + " "); 14 System.out.println(); 15 } 16 } Which keyword is used to indicate that a class can be subclassed?Classes in Java exist in a hierarchy. A class in Java can be declared as a subclass of another class using the extends keyword.
What is super class and subclass?Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).
What is subclassing?Subclassing means to define a new class that has the properties of an old class (the "superclass") with some changes.
What is subclass in Java with example?A subclass is also called a child class and a class whose subclass is made is called a superclass or parent class. The process of creating a subclass of a class is called inheritance. Thus, in the Square-Rectangle example, Rectangle is the superclass and Square is the subclass.
|