Question
10.A class is a blueprint or a template to create objects of identical type. a.False b.True 11.What is the output of the following program code
10.A class is a blueprint or a template to create objects of identical type.
a.False
b.True
11.What is the output of the following program code ?
double cost = -45; try{ if ( cost < 0) throw new RuntimeException( Invalid Cost ); } catch(RuntimeException e){ System.out.print(e.getMessage()); } System.out.println("Stop Program"); |
a.No output
b.Invalid Cost Stop Program
c.Stop Program
d.Invalid Cost
12.Analysis the following class definition and answer the following question.
class Test{ double mark; void setMark (double m){ mark = m; } private double calTotal(){ return mark * 0.5; } void display(){ System.out.println(mark); }} |
What is the access specifier of the class?
a.Public
b.Special
c.Protected
d.Private
13.Which is a relational operator in Java?
a.%
b.+
c.==
d.;
14.What is the output of the following program code?
int id = 0; try{ if (id == 0) throw new RuntimeException(id is zero ); } catch(RuntimeException e){ System.out.print(e.getMessage()); } finally{ System.out.println("Close Program"); } |
a.Close Program
b.No output
c.id is zero
d.id is zero Close Program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started