Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

List and explain various features of java. Explain the words super, static, and final using examples Provide the output of the following program for the

List and explain various features of java.

Explain the words super, static, and final using examples

Provide the output of the following program for the values of y=0 and y=2:

public class Test {

public static void main(String args[]) {

try {

System.out.println("calling method a");

a(); System.out.println("return from method a");

} catch(ArithmeticException e) {

System.out.println("main: catch");

} finally {

System.out.println("main: finally");

} } public static void a() {

try {

int x=8,y=0;

int z=x/y;

System.out.println("value of z="+z);

} catch(NumberFormatException e) {

System.out.println("method a:catch");

} finally

{ System.out.println("method a:finally");

} }}

Explain both overloading and overriding, and provide an example for each.

Declare a class called employee having employee_id and employee_name as members.

Extend class employee to have a subclass called salary having designation and monthly) salary as members.

Define the following:

  1. Required constructor.
  2. A method to find and display all details of employees drawing a salary more than 20,000/-.
  3. Method main for creating an array for storing these details given as command line arguments and showing usage methods.

Describe abstract class called Shape. This class has three subclasses called: Triangle, Rectangle and Circle. Define one method area () in the abstract class and override this area() in these three subclasses to calculate the area for specific class' object.

Declare a class called coordinate. This is to represent 3 dimensional Cartesian coordinates (x, y and z). Define the following methods:

  1. Constructor
  2. Display, to print values of members
  3. Add_coordinates, to add three such coordinate objects to produce a resultant coordinate object. Generate and handle exceptions if x, y and z coordinate of the result are zero.
  4. Main, to show use of the above methods.

Write a java application that has three Buttons labeled: Red, Green, and Blue. The java application should have the following:

When clicking on the background, the color should change accordingly and have a label displaying the color selected.

Write an application that creates and starts three threads.

Each thread is instantiated from the same class.

It executes a loop with 10 iterations.

  1. Each iteration displays the string "HELLO"
  2. Sleeps for 300 milliseconds.
  3. The application waits for all the threads to complete & displays the message "Good Bye...".

Draw a use case diagram for a Library Management System.

Answer the following:

  1. Collection in JAVA.
  2. Features of Map Interface.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions