Java Daily Task
Java Daily Task
1.Java Introduction
2.Class,Method,Object
3.Same package and Different package
4.Encapsulation
QUESTIONS(Theory):
1.What is platform independent?
2.What is open source?
3.Difference between JDK,JRE,JVM?
4.why we go for java?
5.What is the latest version of JDK and which version you are using in your project?
6.What is the latest version of eclispe and which version you are using in your project?
7.Difference between c++ and java?
8.Features of java?
9.What type of tool you are using in your project to execute java?
10.Difference between class,method,object?
11.Where object stores?
12.How to access one class method in to another package in different package?
13.What is encapsulation?
14.Coding standard to create project,class,method,package and object ?
15.What gives Java it's "write once and run anywhere" nature?
QUESTIONS(Programs):
QUESTION 1:
Project :EmployeeDetails
Package :org.emp
Class :Employee
Methods :empId(),empName(),empDob(),empPhone(),empEmail(),empAddress()
Description:
Create an object for employee class and call above methods also follow the all coding
standards.
QUESTION 2:
Project :GreensAddress
Package :org.add
Class :GreensTech
Methods
:greensOmr(),greensAdayar(),greensTambaram(),greensVelacherry(),greensAnnaNagar()
Description:
Create an object for GreensTech class and call above methods also follow the all coding
standards.
QUESTION 3:
Project :CompanyDetails
Package :org.company
Class :CompanyInfo
Methods :companyName(),companyId(),companyAddress()
Description:
Create an object for CompanyDetails class and call above methods also follow the all coding
standards.
QUESTION 4:
Project :MyPhone
Package :org.phone
Class :PhoneInfo
Methods :phoneName(),phoneMieiNum(),Camera(),storage(),osName()
Description:
Create an object for PhoneInfo class and call above methods also follow the all coding
standards.
QUESTION 5:
Project :LanguageDetails
Package :org.lang
Class :LanguageInfo
Methods :tamilLanguage(),englishLanguage(),hindiLanguage()
Class :StateDetails
Methods :southIndia(),northIndia()
Description:
Create an object for LanguageInfo and StateDetails inside the StateDetails class and call both
classes methods also follow the all coding standards.
QUESTION 6:
Project :EmployeeInformation
Package :org.emp
Class :Employee
Methods :empName()
Package :org.company
Class :Company
Methods :companyName()
Package :org.client
Class :Client
Methods :clientName()
Package :org.project
Class :Project
Methods :projectName()
Description:
Create an object for all 4 classes inside the Employee class and call all classes methods also
follow the all coding standards.
QUESTION 7:
Project :PhoneDetails
Package :org.phone
Class :ExternalStorage
Methods :size()
Class :InternalStorage
Methods :processorName(),ramSize()
Description:
Create an object for ExternalStorage and InternalStorage inside the InternalStorage class and
call both classes methods also follow the all coding standards.
QUESTION 8:
Project :CollegeInformation
Package :org.college
Class :College
Methods :collegeName(),collegeCode(),collegeRank()
Class :Student
Methods :studentName(),studentDept(),studentId()
Class :Hostel
Methods :hostelName()
Class :Dept
Methods :deptName()
Description:
Create an object for all 4 classes inside the College class and call all classes methods also
follow the all coding standards.
QUESTION 9:
Project :VehicleInformation
Package :org.allvehicle
Class :Vehicle
Methods :VehicleNecessery()
Package :org.twowheeler
Class :TwoWheller
Methods :bike(),cycle()
Package :org.threewheeler
Class :ThreeWheeler
Methods :Auto()
Package :org.fourwheeler
Class :FourWheeler
Methods :car(),bus(),lorry()
Description:
Create an object for all 4 classes inside the Vehicle class and call all classes methods also
follow the all coding standards.
QUESTION 10:
Project :TransportInformation
Package :org.transport
Class :Transport
Methods :TransportForm
Package :org.road
Class :Road
Methods :bike(),cycle(),bus(),car()
Package :org.air
Class :Air
Methods :aeroPlane(),heliCopter()
Package :org.water
Class :Water
Methods :boat(),ship()
Description:
Create an object for all 4 classes inside the Transport class and call all classes methods also
follow the all coding standards.
QUESTION 11:
Project :NetworkInformation
Package :org.network
Class :Wifi
Methods :wifiName()
Class :MobileData
Methods :dataName()
Class :Lan
Methods :lanName()
Class :Wireless
Methods :modamName()
Description:
Create an object for all 4 classes inside the Wifi class and call all classes methods also follow
the all coding standards.
1.Inheritance
2.Access specifiers
3.Data types
4.Scanner class
QUESTIONS(Theory)
1.What is mean by inheritance?
2.Types of inheritance and explain all types?
3.What is mean by multiple inheritance,why java won't support multiple inheritance?
4.Difference between hybrid and hierachical inheritance?
5.What is the use of access specifier and types?
6.Difference between public and protected?
7.What is mean by Wrapper class?
8.What is default value of String?
9.What is difference between primitive and non primitive datatypes?
10.What is default package in java?
11.What is the super class of all java class?
12.What is use of scanner class?
13.What are the different methods available in Scanner class?
14.Scanner class is under which package?
15.Difference between next() and nextLine()?
QUESTIONS(Programs)
QUESTION 1:
Description: Using Scanner class get the below details
empId
empName
empEmail
empPhoneno
empSalary
empGender
empCity
QUESTION 2:
Description: Using Scanner class get the below details
studentId
studentName
Mark1
Mark2
Mark3
Mark4
Mark5
:Find the total and average of marks
QUESTION 3:
package name: org.all
Project name: LanguageDetails
Class name : Languageclass
Methods : alllanguage
QUESTION 4:
package name: org.india
Project name: SouthIndia
Class name : India
Methods : india
QUESTION 5:
Project :CollegeInformation
Package :org.college
Class :College
Methods :collegeName(),collegeCode(),collegeRank()
Class :Student
Methods :studentName(),studentDept(),studentId()
Class :Hostel
Methods :HostelName()
Class :dept
Methods :deptName()
Description:
create above 4 class and call all your class methods into the Student using multilevel
inheritance.
QUESTION 6:
Project :COmputer
Class :Computer
Methods :computerModel()
Class :Desktop
Methods :desktopSize()
Description:
create above 2 class and call all your class methods into the Desktop using single inheritance.
QUESTION 7:
Project :LanguageDetails
Package :org.lang
Class :LanguageInfo
Methods :tamilLanguage(),englishLanguage(),hindiLanguage()
Class :StateDetails
Methods :southIndia(),northIndia()
Description:
create above 2 class and call all your class methods into the LanguageInfo using single
inheritance.
QUESTION 8:
Description: Using Scanner class get the below details
StudentId
StudentName
StudentEmail
StudentPhoneno
StudentDept
StudentGender
StudentCity
QUESTION 9:
Project :BankDetails
Package :org.bank
Class :BankInfo
Methods :saving(),fixed()
Class :AxisBank
Methods :deposit()
Description:
create above 2 class and call all your class methods into the BankInfo using single
inheritance.
QUESTION 10:
Project :CompanyDetails
Package :org.company
Class :Company
Methods :companyName()
Package :org.client
Class :Client
Methods :clientName()
Description:
create above 2 packages and call all your class methods into the Comapany using single
inheritance.
QUESTION 11:
Project :EducationInformation
Package :org.edu
Class :Education
Methods :ug(),pg()
Class :Arts
Methods :bsc(),bEd(),bA(),bBA()
Class :Engineering
Methods :bE(),bTech()
Class :Medicine
Methods :physiyo(),dental(),mbbs()
Description:
create above 4 class and call all your class methods into the Education using multilevel
inheritance.
Day 3_Polymorphism,Abstraction
1.Polymorphism
2.Abstraction
QUESTIONS(Theory)
1.What is mean by polymorphism?
2.Difference between method overloading and method overriding?
3.What is mean by Abstraction?
4.Difference between Abstract class and interface?
5.What is mean by abstract method?
6.Can we create object for abstract class?
7.In interface,can we make method as static?
8.In interface,can we make method as final?
9.How will achieve multiple inheritance in java,write a code for that?
QUESTIONS(Programs)
QUESTION 1:
Find the answer for below questions and tell whether it is possible or not?
I implements I
I implements C
I implements A
I extends I
I extends C
I extends A
C implements I
C implements C
C implements A
C extends I
C extends C
C extends A
A implements I
A implements C
A implements A
A extends I
A extends C
A extends A
A-abstract class
C-class
I- interface
QUESTION 2:
Project :EmployeeDetails
Package :org.emp
Class :Employee
Methods :empId()
Description
You have to overload the method empId() based on different datatype in arguments.
QUESTION 3:
Project :CompanyDetails
Package :org.company
Class :CompanyInfo
Methods :companyName()
Description
You have to overload the method companyName() based on different Number of arguments.
QUESTION 4:
Project :MyPhone
Package :org.phone
Class :Phone
Methods :phoneInfo()
Description
You have to overload the method phoneInfo() based on different datatype order in arguments.
QUESTION 5:
Project :GreensAddress
Package :org.add
Class :GreensTech
Methods :greensOmr()
Description
You have to overload the method greensOmr() based on order,type,number.
QUESTION 6:
Project :BankDetails
Package :org.bank
Class :BankInfo
Methods :saving(),fixed(),deposit()
Class :AxisBank
Methods :deposit()
Description:
You have to override the method deposit in AxisBank.
QUESTION 7:
Project :EducationInformation
Package :org.edu
Class :Education
Methods :ug(),pg()
Class :Arts
Methods :bSc(),bEd(),bA(),bBA(),ug(),pg()
Description:
You have to override the method ug(),pg() in Arts.
QUESTION 8:
Project :UniversityInformation
Package :org.univ
Class :University
Methods :ug(),pg()
Class :College
Methods :ug(),pg()
Description:
ug(),pg() is just a templete in University class and You have to override the method ug(),pg()
in College class.
QUESTION 9:
Project :BikeInformation
Package :org.bike
Interface :Bike
Methods :cost(),speed()
Class :Ktm
Methods :cost(),speed()
Description:
cost(),speed() is just a templete in Bike Interface and You have to override the method
cost(),speed() in Ktm class.
QUESTION 10:
Project :Computer
Interface :HardWare
Methods :hardwareResources()
Interface :Software
Methods :softwareResources()
Class :Desktop
Methods :desktopModel()
Description:
create 2 Interface and archieve multiple inheritance.
Day 4_ControlStatements
1.if/else if
2.Loopings(for,while,do-while)
3.Switch case
4.break/continue
QUESTIONS(Theory)
1.What is difference between break and continue?
2.Whether we can use continue statement in switch?
3.What is mean by control statments and types?
4.What is mean by for loop?
5.Can you explain about for loop execution process?
6.What is difference between while and do-while?
7.What is the use of default keyword in switch?
8.Difference between for and while loop?
}
System.out.println(i);
}}}
QUESTION 2:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
if (i == 5) {
break;
}
System.out.println(i);
}}}
QUESTION 3:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
if (i == 5) {
continue;
}
System.out.println(i);
}}}
QUESTION 4:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
System.out.println(j);
}}}}
QUESTION 5:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
System.out.println(i);
}}}
QUESTION 6:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= i; j++) {
System.out.println(j);
}}}
QUESTION 7:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = i + 1; j <= 3; j++) {
System.out.println(j);
}}}
QUESTION 8:
package org.test;
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = i + 1; j <= i; j++) {
System.out.println(j);
}}}}
QUESTION 9:
package org.test;
public class Hello {
public static void main(String[] args) {
int i=5;
if (i == 5) {
break;
}
System.out.println(i);
}}
QUESTION 10:
package org.test;
public class Hello {
public static void main(String[] args) {
int i=5;
if (i == 5) {
continue;
}
System.out.println(i);
}}
QUESTIONS(Programs)
QUESTION 1:
Description: Write Java program to allow the user to input his/her age.
Then the program will show if the person is eligible to vote.
A person who is eligible to vote must be older than or equal 1 to 18 years old.
Example:
Input = 10
Output = print not eligible.
QUESTION 2:
Description: Write a program to find even or odd number
Example:
Input = 10
Output = Even
QUESTION 3:
Description: Write a program to print even number from 1 to 100
Example:
Output = 2,4,....100
QUESTION 4:
Description: Find the sum of odd number 1 to 100
Example:
Output = 2500
QUESTION 5:
Description: Count of even number 1 to 100
Example:
Output = 50
QUESTION 6:
Description: Write a program to find the factorial of a number.
Example:
Input = 5
Output = 120
QUESTION 7:
Description: Write a program to print the fibonacci series of a number 1 to 100.
Example:
Output = 0,1,1,2,3,5.....
QUESTION 8:
Description: Find prime number or not.
Example:
Input = 11
Output = prime number
QUESTION 9:
Description : Print the below patterns using for loop.
Output:
1
12
123
1234
12345
123456
1234567
-----------------------
*
* *
* * *
* * * *
* * * * *
--------------------------
*
**
***
****
*****
-----------------------------
QUESTION 10:
Description: Find Amstrong number or not
Example:
Input = 153
Output = Amstrong number
QUESTION 11:
Description: Reverse the number
Example:
Input = 123
Output = 321
QUESTION 12:
Description: Count of the number
Example:
Input = 123
Output = 3
QUESTION 13:
Description: Sum of the number
Example:
Input = 123
Output = 6
QUESTION 14:
Description: Verify the number is palindrome number not
Example:
Input = 141
Output = Palindrome
QUESTIONS(Theory)
QUESTION 2:
package org.test;
public class A extends B{
public A() {
System.out.println("Default const...");
}
public static void main(String[] args) {
A a = new A();
}
}
package org.test;
public class B {
public B() {
System.out.println("Super class");
}}
QUESTION 3:
package org.test;
public class A extends B{
public A() {
System.out.println("Default const...");
}
public static void main(String[] args) {
A a = new A();
}
}
package org.test;
public class B {
public B() {
System.out.println("Super class");
}
public B(int id) {
System.out.println(id);
}
QUESTION 4:
package org.test;
public class A extends B {
public A() {
super(12);
System.out.println("Default const...");
}
public static void main(String[] args) {
A a = new A();
}}
package org.test;
public class B {
public B() {
System.out.println("Super class");
}
public B(int id) {
System.out.println(id);
}}
QUESTION 5:
package org.test;
public class B {
public B(int id) {
System.out.println(id);
}}
package org.test;
public class A extends B {
public A() {
super(12);
System.out.println("Default const...");
}
public static void main(String[] args) {
A a = new A();
}}
QUESTION 6:
package org.test;
public class A extends B {
public A() {
System.out.println("Default const...");
}
public static void main(String[] args) {
A a = new A();
}}
package org.test;
public class B {
public B(int id) {
System.out.println(id);
}}
DAY 6 String
1.String functions
2.Literal String
3.Non Literal String
4.Mutable String
5.ImMutable String
QUESTIONS(Theory)
1.What is mean by string?
2.How to find length of the string?
3.How to find partcular character in string?
4.How to split the string?
5.What is difference between literal String and non literal string?
6.What is mutable and immutable string?
7.Difference between stringbulider and stringbuffer?
8.Method name to identify memory location?
9.What are the string functions available in java?
10.What is difference between charAt() and contains() method?
11.What is the return type of compareTo()
12.Where the Literal String and non literal String stores?
13.What is mean by ASCII value?
QUESTIONS(Programs)
QUESTION 1:
Description: Find the length of the below string
String 1: GreensTechnology
String 2: SeleniumAutomationtool
String 3: velmurugan
String 4: j a v a p r o g r a m
String 5: 9095484678
QUESTION 2:
Description: Find the particular character index in the given string
String 1: GreensTechnology
Find the last index of o
String 2: SeleniumAutomationtool
Find the index of o
String 3: Velmurugan
Find the index of n
String 4: j a v a p r o g r a m
Find the last index of (emptyspace)
String 5: 9095484678
Find the index of 8
Question 3:
Description: Find the particular character in the given string
String 1: GreensTechnology
print the character h
String 2: SeleniumAutomationtool
print the character o
String 3: velmurugan
print the character u
String 4: j a v a p r o g r a m
print the character p
String 5: 9095484678
print the character 7
QUESTION 4:
Description : Get two input from user and check the equality
: print in the output whether it is Equal or not
Example:
Input :
String 1 : Java
String 2 : Java
Example:
Input :
String 1 : Java
String 2 : java
Example:
Input :
String 1 : Green Technology
String 2 : GreenTechnology.
Example(use equalsIgnoreCase):
Input :
String 1 : Java
String 2 : java
Example(use equalsIgnoreCase) :
Input :
String 1 : Nisha
String 2 : nisha
QUESTION 5:
QUESTION 5.1:
Description: Get the email id from the user and verify '@' is present or not?
Example:
Input = velmurugank451@gmail.com
Output = valid email id
QUESTION 5.2:
Description:Get the address from the user and verify "pincode" is present or not?
Example:
Input = 5-35-2a,venkatesh nivas,Aruppukottai
Output = invalid address
QUESTION 5.3:
Description:Get the email from the user and verify '@' is present or not and return true or
false?
Example:
Input = Nishakerala24@gmail.com
Output = True/False
QUESTION 5.4:
Description:Get the phonenumber from the user and verify any character is present or not .
If character is present return invalid number
Example:
Input = 90954a6o78
Output = False
QUESTION 6:
Description:Get the phonenumber from the user .
If phonenumber exceeds greater than 10 then return invalid number
Example:
Input = 89034256972365
output = invalid
Example 2:
Input = 9095484678
Output = valid
QUESTION 7:
QUESTION 7.1:
Description:Given string as "Welcome to java class" and replace java into sql.
Example:
Input = Welcome to class java
output = Welcome to class sql
QUESTION 7.2:
Description:Given string as "Greens Adayar"and replace Adayar into Omr.
Example:
Input = Greens Adayar
Output = Greens Omr
QUESTION 7.3:
Description: Given String as "Welcome to java class" and Replace space into '#'
Example:
input:Welcome to java class
output:Welcome#to#java#class
QUESTION 7.4:
Description:Get the email from the user and verify "gmail" is present or not.
If present replace that gmail into yahoo
Example:
Input = Nishakerala24@gmail.com
Output = Nishakerala24@yahoo.com
QUESTION 7.5:
Description:Get the address from the user and verify "pincode" is present or not.
If present replce the pincode with empty space
Example:
Input = 5-35-2a,venkatesh nivas,Aruppukottai,pincode-626101
Output = 5-35-2a,venkatesh nivas,Aruppukottai
QUESTION 8
QUESTION 8.1
Description:Get the input from the user and print that word in lowercase
Example:
Input = NISHANTHI
Output = nishanthi
QUESTION 8.2
Description:Get the input from the user and print that word in Uppercase
Example:
Input = nishanthi
Output = NISHANTHI
QUESTION 8.3
Description:Convert all small letter and into capital letter
Example:
Input = WelcomE
Output = wELCOMe
QUESTION 8.4
Description:Find the number of uppercase count and lowercase count in the given String
Example:
Input = WelComeToJava
Output:
UpperCase=4
LowerCase=9
QUESTION 9
QUESTION 9.1
Description: Given String as "Welcome to java class" and verify whether the given string
startsWith welcome
Example:
Input = Welcome to class java
output = True
QUESTION 9.2
Description: Given String as "Hai i am nisha" and verify whether the given string startsWith
welcome
Example:
Input = Hai i am nisha
output = False
QUESTION 9.3
Description: Given String as "Welcome to java class" and verify whether the given string
endsWith class
Example:
Input = Welcome to java class
output = True
QUESTION 9.4
Description: Given String as "Welcome to java class" and verify whether the given string
endsWith java
Example:
Input = Welcome to java class
output = False
QUESTION 9.5
Description: Given String as "Welcome to java class" and verify whether the string is empty
or not
Example:
Input = Welcome to java class
output = False
QUESTION 9.6
Description: Given String as "" and verify whether the string is empty or not
Example:
Input = ""
Output = False
QUESTION 10
Description : Get two input from user and Compare
Example
String 1 : Nisha
String 2 : nisha
Example
String 1 : Nia
String 2 : nisha
QUESTION 11
QUESTION 11.1
Description : Generate the two literal string and find the identityHashCose()
Example
String 1 : Nisha
String 2 : Nisha
QUESTION 11.2
Description : Generate the two non literal string and find the identityHashCose()
Example
String 1 : Nisha
String 2 : Nisha
QUESTION 11.3
Description : Generate the three non literal string and find the identityHashCose()
Example
String 1 : Nisha
String 2 : Rengan
String 3 : NishaRengan
QUESTION 11.4
Description : Generate the three literal string and find the identityHashCose()
Example
String 1 : Nisha
String 2 : Rengan
String 3 : NishaRengan
QUESTION 12
QUESTION 12.1
Description: Given String as "Welcome to java class" and split it by space.
Example:
Input :Welcome to java class
Output:
Welcome
to
java
class
QUESTION 12.2
Description: Given String as "Welcome to java class" and split it by l
Example:
Input :Welcome to java class
Output:
We
come to java c
ass
QUESTION 13
QUESTION 13.1
Description: Given String as "Welcome to java class" and generate a substring.
Example:
Input :Welcome to java class
Output:
Welcome
QUESTION 14
Example:
Description: Given String as "Welcome" and the number of consonant count and vowels
count
Example:
Input = Welcome
output:
vowels = 3
consonant = 4
QUESTION 15:
Description: Find the count of caps,small,number and special character in given string
Example:
Input : Welcome To Java class @123
Output
caps count :3
small count :15
number count:3
Special char:5
QUESTION 16
Description: Replace all vowels char into '@'
Example:
Input = Welcome
Output = W@lc@m@
DAY 7 Array,Collection,List
1.Arrays
2.Collections Introduction
3.List(ArrayList only)
QUESTIONS(Theory)
1.What do you mean by an array and How to create an Array?
2.Can you change size of array once created?
3.Is it legal to initialize an array int i[] = {1, 2, 3, 4, 5}
4.Advantages and disadvantages of Array?
5.Can we change the size of an array at run time?
6.Can you declare an array without assigning the size of an array?
7.What is the default value of Array?
8.How to print element of Array?
9.How to compare Two Arrays?
10.How to sort an Array?
11.Can we declare array size as a negative number?
12.Can we add or delete an element after assigning an array?
13.Can we use Generics with the array?
14.What is collection and explain about types?
15.What is the difference between ArrayList and Vector?
16.What is the difference between ArrayList and LinkedList?
17.How to convert Array to List and List to Array
QUESTION 2:
Description : Write a Java program to calculate the average value of array elements.
Input a[]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Output = average = 7.0
QUESTION 3:
Description : Write a Java program to remove duplicates from array
Input a[]= {10,10,20,50,60,80,60,50}
Output a[]= {10,20,50,60,80}
QUESTION 4:
QUESTION 4.1:
Description : Create a new ArrayListlist with values and find the length of it
Input : List = 10,20,30,90,10,10,40,50
QUESTION 4.2:
Description : Create a new LinkedListlist with values and find the length of it
Input : List = 100,200,300,400,500,600,700
QUESTION 4.3:
Description : Create a new vector with values and find the length of it
Input : List = 105,205,305,405,505,605,705,805
QUESTION 4.4:
Description : Create a new LinkedListlist with values and find the size() of it.
Input : List = 100,200,300,400,500,600,700
QUESTION 5:
QUESTION 5.1:
Description : Get the first index value of 10
Input: List = 10,20,30,90
QUESTION 5.2:
Description : Get the last index value of 10
Input: List = 10,20,30,90,10,10,40,50
QUESTION 5.3:
Description : Get the index value of 50
Input: List = 10,20,30,90,10,10,40,50
QUESTION 5.4:
Description : Get the index value of 90
Input: List = 10,20,30,90,10,10,40,50
QUESTION 5.5:
Description : Get the each index value of 10 present in below list
Input: List = 10,20,30,90,10,10,40,50,10
QUESTION 5.6:
Description : Get the each index value of 70 present in below list
Input: List = 10,20,30,90,10,10,40,50,10
QUESTION 6:
QUESTION 6.1:
Description : Get the value present at 2nd index
Input: List = 10,20,30,40,50,60
QUESTION 6.2:
Description : Get the value present at 4th index
Input: List = 100,200,300,400,500,600,700
QUESTION 6.3:
Description : Get the value present at 8th index
Input: List = 105,205,305,405,505,605,705,805
QUESTION 6.4:
Description : Get the each value of list by using normal for loop
Input: List = 105,205,305,405,505,605,705,805
QUESTION 6.5:
Description : Get the each value of list by using enhanced for loop
Input: List = 105,205,305,405,505,605,705,805
QUESTION 7:
QUESTION 7.1:
Description : Remove the value present at 2nd index
Input: List = 10,20,30,40,50,60
QUESTION 7.2:
Description : Remove the value present at 10th index
Input: List = 10,20,30,90,10,10,40
QUESTION 7.3:
Description : Remove the last value of 10 present in the list
Input: List = 10,20,30,90,10,10,40
QUESTION 8:
QUESTION 8.1:
Description : Add a value 50 in the 2nd index and display the list after adding.
Input : List = 10,20,30,90,10,10,40,50
QUESTION 8.2:
Description : Add a value 70 at the end of the list
Input : List = 10,20,30,90,10,10,40,50
QUESTION 8.3:
Description : Add a value 80 at the 8th index of list
Input : List = 10,20,30,90,10,10,40,50
QUESTION 8.4:
Description : Add a value 100 at the last index of 10 in the list
Input : List = 10,20,30,90,10,10,40,50
QUESTION 9:
QUESTION 9.1:
Description : Replace the value 300 into 350 in the list
Input : List = 100,200,300,400,500,600,700
QUESTION 9.2:
Description : Replace the value present in 7th index as 90
Input: List = 10,20,30,90,10,10,40,50,10
QUESTION 9.3:
Description : Replace the 10 into 100 in List
Input: List = 10,20,30,90,10,10,40,50,30
Output: List = 100,20,30,90,100,100,40,50,30
QUESTION 10:
QUESTION 10.1:
Description : Create a new ArrayListlists with values and return the common values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80
QUESTION 10.2:
Description : Create a new ArrayListlists with values and return the common values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90
QUESTION 10.3:
Description : Create a new ArrayListlists with values and return the common values
Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000
QUESTION 11:
QUESTION 11.1:
Description : Create a new ArrayListlists with values and perform removeAll() function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80
QUESTION 11.2:
Description : Create a new ArrayListlists with values and perform removeAll() function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90
QUESTION 11.3:
Description : Create a new ArrayListlists with values and perform removeAll() function
Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000
QUESTIONS(Theory)
1.Describe the Collections type hierarchy. What are the main interfaces, and what are the
differences between them?
2.Explain about user defined list?
3.Mention what is Linked List?
4.what is difference between set and List?
5.What is the difference between HashSet and TreeSet ?
6.Difference between Enumurator,Iterator and List Iterator
7.How to convert List into Set
QUESTIONS:
QUESTION 1.1:
Description : Create a HashSet for the below values
Input : List = 10,20,30,40,50,60,70,80,90,10,20
QUESTION 1.2:
Description : Create a LinkedHashSet for the below values
Input : List = 10,20,30,40,50,60,70,80,90,10,20
QUESTION 1.3:
Description : Create a TreeSet for the below values
Input : List = 10,20,30,40,50,60,70,80,90,10,20
QUESTION 2:
QUESTION 2.1:
Description : Convert the below list in to set(use addAll()) method
Input : List = 10,20,30,90,10,10,40,50
QUESTION 2.2:
Description : Convert the below list in to set(use addAll()) method
Input : List = 105,205,305,405,505,605,705,805,505,605
QUESTION 2.3:
Description : Convert the below list in to set(use addAll()) method
Input : List = 100,200,300,400,500,600,700,100,300,500
QUESTION 3:
QUESTION 3.1:
Description : Get the each value of set by using enhanced for loop
Input: List = 105,205,305,405,505,605,705,805
QUESTION 3.2:
Description : Create a TreeSet and iterate each value in the set by using enhanced for loop
Input : List = 10,20,30,40,50,60,70,80,90,10,20
QUESTION 3.3:
Description : Create a HashSet and iterate each value in the set by using enhanced for loop
Input : List = 10,20,30,40,50,60,70,80,90,10,20
QUESTION 4:
QUESTION 4.1:
Description : Create a new HashSet with values and return the common values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80
QUESTION 4.2:
Description : Create a new LinkedHashSet with values and return the common values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90
QUESTION 4.3:
Description : Create a new TreeSet with values and return the common values
Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000
QUESTION 5:
QUESTION 5.1:
Description : Create a new HashSet with values and perform removeAll() function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80
QUESTION 5.2:
Description : Create a new LinkedHashSet with values and perform removeAll() function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90
QUESTION 5.3:
Description : Create a new TreeSet with values and perform removeAll() function
Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000
QUESTION 6:
Description: Create a userdefine Set and insert the 10 employee details
Input : empId,name,phone,address,dob,doj,eMail,gender,Sal
Output: Using scanner class insert 10 employee details
QUESTION 7:
Description: Create a userdefine Set and insert the 10 Student details
Key : stdId,stdName,stdPhone,address,dOB,eMail,gender
Give the related values for key for each Student
QUESTIONS(Theory)
1.What is map?
2.What is difference between Hash Map and Hash Table?
3.What is difference between set and Map?
4.What are the classes implementing List interface?
5.Which all classes implement Set interface ?
6.Explain about user defined Map?
7.How null allows in below maps:
HashMap :k?,v?
LinkedHashMap:k?,v?
TreeMap :k?,v?
HashTable :k?,v?
8.How to Iterate Map ?
9.Return type entrySet?
QUESTIONS(practical)
QUESTION 1.1:
Description : Create a HashMap with the below key and values
key : 10,20,30,40,50,60,10,50,40
values : java,sql,oops,Sql,oracle,DB,selenium,psql,Hadoop.
QUESTION 1.2:
Description : Create a LinkedHashMap with the below key and values
key : 10,20,30,40,50,60,10,50,40
Values : 10,20,30,40,50,60,10,50,40
QUESTION 1.3:
Description : Create a TreeHashMap with the below key and values
key : !,@,#,$,%,^,&,*,(,
Values : 10,20,30,40,50,60,10,50,40
QUESTION 1.4:
Description : Create a HashTable with the below key and values
Key : vel,Ganesh,Dinesh,Vengat,subash
Values : Selenium,framework,oracle,corejava,jira
QUESTION 2:
QUESTION 2.1:
Description : Create a HashMap with the below key and values and get(print) the key only in
the map.
key : 10,20,30,40,50,60,10,50,40
values : java,sql,oops,Sql,oracle,DB,selenium,psql,Hadoop.
QUESTION 2.2:
Description : Create a LinkedHashMap with the below key and values and get(print) the key
only in the map.
key : 10,20,30,40,50,60,10,50,40
Values : 10,20,30,40,50,60,10,50,40
QUESTION 2.3:
Description : Create a TreeMap with the below key and values and get(print) the key only in
the map.
key : !,@,#,$,%,^,&,*,(,
Values : 10,20,30,40,50,60,10,50,409
QUESTION 2.4:
Description : Create a HashTable with the below key and values and get(print) the key only
in the map.
Key : vel,Ganesh,Dinesh,Vengat,subash
Values : Selenium,framework,oracle,corejava,jira
QUESTION 3:
QUESTION 3.1:
Description : Create a HashMap with the below key and values and get(print) the values only
in the map.
key : 10,20,30,40,50,60,10,50,40
values : java,sql,oops,Sql,oracle,DB,selenium,psql,Hadoop.
QUESTION 3.2:
Description : Create a LinkedHashMap with the below key and values and get(print) the
values only in the map.
key : 10,20,30,40,50,60,10,50,40
Values : 10,20,30,40,50,60,10,50,40
QUESTION 3.3:
Description : Create a TreeHashMap with the below key and values and get(print) the values
only in the map.
key : !,@,#,$,%,^,&,*,(,
Values : 10,20,30,40,50,60,10,50,409
QUESTION 3.4:
Description : Create a HashTable with the below key and values and get(print) the key only
in the map.
Key : vel,Ganesh,Dinesh,Vengat,subash
Values : Selenium,framework,oracle,corejava,jira
QUESTION 4:
QUESTION 4.1:
Description : Create a HashMap with the below key and values and iterate it using enhanced
for loop.
key : 10,20,30,40,50,60,10,50,40
values : java,sql,oops,Sql,oracle,DB,selenium,psql,Hadoop.
QUESTION 4.2:
Description : Create a LinkedHashMap with the below key and values and iterate it using
enhanced for loop.
key : 10,20,30,40,50,60,10,50,40
Values : 10,20,30,40,50,60,10,50,40
QUESTION 4.3:
Description : Create a TreeHashMap with the below key and values and iterate it using
enhanced for loop.
key : !,@,#,$,%,^,&,*,(,
Values : 10,20,30,40,50,60,10,50,409
QUESTION 4.4:
Description : Create a HashTable with the below key and values and iterate it using enhanced
for loop.
Key : vel,Ganesh,Dinesh,Vengat,subash
Values : Selenium,framework,oracle,corejava,jira
QUESTION 5:
QUESTION 5.1:
Description : Create a HashMap with the below key and values and iterate it using enhanced
for loop and get the key and values combination.
key : 10,20,30,40,50,60,10,50,40
values : java,sql,oops,Sql,oracle,DB,selenium,psql,Hadoop.
Sample Output:
10
java
20
sql
30
oops
40
sql
Description : like this you have to itearte the map
QUESTION 5.2:
Description : Create a LinkedHashMap with the below key and values and iterate it using
enhanced for loop and get the key and values combination..
key : 10,20,30,40,50,60,10,50,40
Values : 10,20,30,40,50,60,10,50,40
QUESTION 5.3:
Description : Create a TreeHashMap with the below key and values and iterate it using
enhanced for loop and get the key and values combination.
key : !,@,#,$,%,^,&,*,(,
Values : 10,20,30,40,50,60,10,50,409
QUESTION 5.4:
Description : Create a HashTable with the below key and values and iterate it using enhanced
for loop and get the key and values combination.
Key : vel,Ganesh,Dinesh,Vengat,subash
Values : Selenium,framework,oracle,corejava,jira
QUESTION 6:
Description: Create a userdefine Map and insert the 10 employee details
Key : empId,name,phone,address,dob,doj,eMail,gender,Sal
Give the related values for key for each employee
QUESTION 7:
Description: Create a userdefine Map and insert the 10 Student details
Key : stdId,stdName,stdPhone,address,dOB,eMail,gender
Give the related values for key for each Student
DAY 10 Exception:
1.Exception
2.throw and throws
3.User define exception
QUESTIONS(Theory)
1.what is Exception?
2.Explain about types of Expection?
3.Difference between checked expection and unchecked expection?
4.What are the differences between exception and error?
5.What is the super class for Exception and Error?
6.Exceptions are defined in which java package
7.What is throw keyword in java?
8.Can we have try block without catch block?
9.Can we write multiple catch blocks under single try block?
10.How to write user defined exception or custom exception in java?
11.What are the different ways to print exception message on console?
12.What are the differences between final finally and finalize in java?
13.Can we write return statement in try and catch blocks?
14.Can we write return statement in finally block?
15.What are the differences between throw and throws?
16.What are the Exception Handling Keywords in Java?
17.Explain Java Exception Hierarchy?
18.How to create custom Exception?
QUESTIONS(Programs)
QUESTION 1:
Description : Find the output for the program:
public class Test
{
public static void main(String[] args)
{
try
{
System.out.printf("1")
int sum = 9 / 0;
System.out.printf("2");
}
catch(ArithmeticException e)
{
System.out.printf("3");
}
catch(Exception e)
{
System.out.printf("4");
}
finally
{
System.out.printf("5");
}}}
QUESTION 2:
Description : Find the output for the program:
public class Test
{
private void m1()
{
m2();
System.out.printf("1");
}
private void m2()
{
m3();
System.out.printf("2");
}
private void m3()
{
System.out.printf("3");
try
{
int sum = 4/0;
System.out.printf("4");
}
catch(ArithmeticException e)
{
System.out.printf("5");
}
System.out.printf("7");
}
public static void main(String[] args)
{
Test obj = new Test();
obj.m1();
}
}}
QUESTION 3:
Description : Find the output for the program:
public class Test
{
public static void main(String[] args)
{
try
{
System.out.printf("1");
int data = 5 / 0;
}
catch(ArithmeticException e)
{
System.out.printf("2");
System.exit(0);
}
finally
{
System.out.printf("3");
}
System.out.printf("4");
QUESTION 4:
Description : Find the output for the program:
public class Test
{
public static void main(String[] args)
{
try
{
System.out.printf("1");
int data = 5 / 0;
}
catch(ArithmeticException e)
{
Throwable obj = new Throwable("Sample");
try
{
throw obj;
}
catch (Throwable e1)
{
System.out.printf("8");
}
}
finally
{
System.out.printf("3");
}
System.out.printf("4");
}}
QUESTION 5:
Description : Find the output for the program:
import java.io.EOFException;
import java.io.IOException;
public class Test
{
public static void main(String[] args)
{
try
{
System.out.printf("1");
int value = 10 / 0;
throw new IOException();
}
catch(EOFException e)
{
System.out.printf("2");
}
catch(ArithmeticException e)
{
System.out.printf("3");
}
catch(NullPointerException e)
{
System.out.printf("4");
}
catch(IOException e)
{
System.out.printf("5");
}
catch(Exception e)
{
System.out.printf("6");
}}}
QUESTIONS(Theory)
1.What is JDBC?
2.What is JDBC Driver?
3.What are the steps to connect to the database in java?
4.What are the JDBC statements?
5.What is the difference between Statement and PreparedStatement interface?
6.what is schema?
7.what is primary key?
8.what is constraints?
QUESTIONS(Program)
Task 1:
Download Sql work bench and do all setup like creating table,assign primary key and
retrieve all the values from Demoqa register table(manually).
Input :FirstName,LastName,MaritalStatus(Single,Married,Divorced),
Hobby(Dance,Reading,Cricket),Country,DateOfBirth,PhoneNumber,
Username,E-mail,AboutYourself,Password,ConfirmPassword
Output:
Table Created.
Inserted value in table
Deleted value in table
Modified value in table
Task 2:
Download Sql work bench and do all setup like creating table,assign primary key and
retrieve all the values from employee table.
Input :EmpId(PrimaryKey),EmpName,EmpSalary,EmpAddress
Output:Print all the values from the table
Sample Output:
--------------
+------+----------+-----------+------------+
|EmpId | EmpName | EmpSalary | EmpAddress |
+------+----------+-----------+------------+
| 101 | Arun | 2000 | Chennai |
| 102 | Siva | 3000 | Madurai |
| 103 | Varun | 2000 | Selam |
| 104 | Tharun | 1000 | Erode |
+------+----------+-----------+------------+
QUESTIONS(Theory)
1.What is mean by File? In which package it is available? 2.What are the methods available
in File ?
3.While creating a file if you not mention the format then under which format it will save the
file?
4.What are the difference between append and updating the file?
5.How to compare paths of two files?
6.How to create a new file?
7.How to get last modification date of a file?
8.How to create a file in a specified directory?
9.How to check a file exist or not?
10.How to make a file read-only?
11.How to renaming a file ?
12.How to get a file's size in bytes?
13.How to change the last modification time of a file ?
14.How to create a temporary file?
15.How to append a string in an existing file?
16.How to copy one file into another file?
17.How to delete a file?
18.How to read a file?
19.How to write to a file?
20.How to create directories recursively?
21.How to delete a directory?
22.How to get the fact that a directory is empty or not?
23.How to get a directory is hidden or not?
24.How to print the directory hierarchy?
25.How to print the last modification time of a directory?
26.How to get the parent directory of a file?
27.How to search all files inside a directory?
28.How to get the size of a directory?
29.How to traverse a directory?
30.How to find current working directory?
31.How to display root directories in the system?
32.How to search for a file in a directory?
33.How to display all the files in a directory?
34.How to display all the directories in a directory?
QUESTIONS(Practical)
QUESTION 1
NOTE: Create a new file
write the file with some 10 lines of text.
QUESTION 2
NOTE: Retrieve the text from the file
Check "java" word contains or not?
QUESTION 3
NOTE: Find the row count from the file.
QUESTION 4
NOTE: Print the last 5 lines from the file.
QUESTION 5
NOTE: Print the odd lines from the file.
QUESTION 6
NOTE: Count the number of duplicate words available in the file.
QUESTION 7
NOTE: Check directory D:\Java is available or not.
QUESTION 8
NOTE: Check directory D:\Java is available or not.
If not create new directory.
QUESTION 9
NOTE: Create sub directory D:\Java\Selenium\Material.
QUESTION 10
OTE: Print all the available files from an existing folder.