Java 1
Java 1
Write a Java program for the following scenario: Run a loop from 1 to 100, while looping when the number
is even print its square and when the number is odd print its cube.
Write a Java Program to make an Exception AgeException. When user passes some age and if age is less
than 18 throw this Exception.
Write a Java class Employee with variables name, age, gender write setter and getter methods for it
Make an Interface CE which have methods call(), sms (), Make another interface ISO which
have methods radiation() and sound(). Make two classes IPhone and Galaxy and make them
implement both the interfaces
Write a Java class for following methods display() -- Display number from 1 to 100 using while
loop in Java fibonacci() -- Prints Fibonacci series till 100
Write a Java Program to determine whether the number is Armstrong or not. Write a class mobile
with methods call() and sms(). Write a class Demo and access it.
Write a Java program to make a package com .shapes, make classes Circle and Square in the same
package.
Write a class Automobile with default constructor, write a class Plane which extends Automobile
and has a default as well as parameterized constructor, write a class Airbus with a default
constructor which extends Plane.
Write a class User with abstract methods pay() and receive(), later make two concrete
class GoldUser and SilverUser, override the abstract method.
Write a Java program for separate hours, minutes and seconds from following string
01:23:45 PM
Write an abstract class Car with methods start() and stop().Write two interfaces SportsCar
and CommercialCar and implement the appropriate interface on the above classes.
Write an abstract class Car with methods start() and stop(). Write a class Santro and Audi
and override the methods.
Sort the given list of objects in order of their email Contact: id, name, email, phone.
Write a Java program to make a package com.shapes, make classes Circle and Square in
the same package.
Write a class User with abstract methods pay() and receive(), later make two concrete
class GoldUser and SilverUser, override the abstract method .
Write a Java class Employee with variables name, age, gender write setter and getter
methods for it.
Write a Java Program to find the number of String starting with „S‟ from following TreeSet [ Smith, Alex ,
Tom, Steve, Mark, Sammy].
Write a Java Program to convert the “59” to Primitive float (without using Constructor of Float).
Write a Java program to write the following, class A with method m1( ) and m2( ) and write a class B with
methods m3( ) and m4( ), Override the methods of A in class B.