Public class school public abstract double numberofstudent given the following piece of code

New Java

Uploaded by

zcvv

0 ratings0% found this document useful (0 votes)

86 views8 pages

Document Information

click to expand document information

Description:

hvjhgkjb

Original Title

new Java

Copyright

© © All Rights Reserved

Available Formats

TXT, PDF, TXT or read online from Scribd

Share this document

Share or Embed Document

Sharing Options

  • Share with Email, opens mail client

    Email

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?

Download now

SaveSave new Java For Later

0 ratings0% found this document useful (0 votes)

86 views8 pages

New Java

Original Title:

new Java

Uploaded by

zcvv

Description:

hvjhgkjb

SaveSave new Java 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

Embed

Share

Print

Download now

Jump to Page

You are on page 1of 8

Search inside document

You're Reading a Free Preview
Pages 5 to 7 are not shown in this preview.

Reward Your Curiosity

Everything you want to read.

Anytime. Anywhere. Any device.

No Commitment. Cancel anytime.

Public class school public abstract double numberofstudent given the following piece of code

Share this document

Share or Embed Document

Sharing Options

  • Share with Email, opens mail client

Quick navigation

  • Home

  • Books

  • Audiobooks

  • Documents

    , active

146 . Output : public class Test{ public static void main(String args[]){ int i = 1; do{ i--; }while(i > 2); System.out.println(i); }


147 . Output : int i = 10; while(i++ <= 10){ i++; } System.out.print(i);


148 . ____________ method cannot be overridden.

Answer: B

Explanation:

final


149 . Given the following piece of code: public class School{ public abstract double numberOfStudent(); } which of the following statements is true?

Given the following piece of code:public class School{ public abstract double numberOfStudent();}which of the following statements is true?

A).  The keywords public and abstract cannot be used together.

B).  You must add a return statement in method numberOfStudent().

C).  You must add a return statement in method numberOfStudent().

D).  Class School must be defined abstract.


1 answers

Answered by Guest on 2021-05-30 12:11:44 | Votes 2 |

 Class School must be defined abstract.

Join Telegram Group

Answer This Question

Name:Email:Answer :Sum of (3+5)Submit:

A. The keywords public and abstract cannot be used together.

B. The method numberOfStudent() in class School must have a body.

C. You must add a return statement in method numberOfStudent().

D. Class School must be defined abstract.

Answer: Option D


What is an abstract class write an example code?

Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class). Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from).

Can abstract class have code?

An abstract method will not have any code in the base class; the code will be added in its derived classes. The abstract method in the derived class should be implemented with the same access modifier, number and type of argument, and with the same return type as that of the base class.

What is an abstract class Mcq?

Explanation: The condition for a class to be called abstract class is that it must have at least one pure virtual function. The keyword abstract must be used while defining abstract class in java. ADVERTISEMENT.

Can public and abstract be used together?

Only public & abstract are permitted in combination to method. Example: public abstract void sum(); We use abstract keyword on method because Abstract methods do not specify a body.