Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
26 views

Java 1

The document contains tasks to write Java programs and classes for various scenarios like swapping two numbers without a third variable, counting vowels in a string, printing even/odd numbers, handling exceptions, creating classes with inheritance and interfaces, sorting collections, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Java 1

The document contains tasks to write Java programs and classes for various scenarios like swapping two numbers without a third variable, counting vowels in a string, printing even/odd numbers, handling exceptions, creating classes with inheritance and interfaces, sorting collections, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 Write a Java class to swap two numbers without using third variable.

 Write a Java program to determine the number of vowels in a String..

 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 Java program to print the following Floyd Triangle.


1
01
101
0101

 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 to print following


12345
1234
123
12
1
 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.

 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 a Java Program to determine reverse the number.

 Write an abstract class Car with methods start() and stop(). Write a class Santro and Audi
and override the methods.

 Write a Java class to print the Fibonacci sequence till 100.

 Create an Exception StringNotPalindromeException. Write a class with method which


throws this Exception when String passed is not palindrome.

 Write a Java Program to find the minimum value in Vector [8,9,1,3,4].

 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].

 Create an Exception StringNotPalindromeException. Write a class with method which


throws this Exception when String passed is not palindrome.

 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.

You might also like