VAIBHAV SINGH
Java Assignments

JAVA - JAVA-1

How many public classes we can have in a single Java File?
How many total main method we can have in one class in Java?
Write 5 classes in single java file and check how many class file generated in folder?
what are all the special character possible with class name?
can we create a class with name "1Test"?
can we create a class with name ""?
can we create a class with name "some chinese character"?
What are all the reserve keyword in Java?
What are all the reserve Literal in Java?
int i = 123_784;
is this statement is valid in java?
what is boolean memory size?
write a program to find 10th number in fibonacci series?
write a program to find 10th number in prime number series?
write a program to find area of a circle, square, rectangle?
write a program to find volume of sphere, cone and cylinder? and find which structure have minimum volumn in all.
Write a code to find sum of all digits of a number.
Suppose Number is 134 then sum should be 1+3+4 = 8
Write a code to find sum of all even index and odd index digits of a number.
Suppose Number is 134856 then odd index sum should be 1+4+5 = 10 and even index sum should be 3+8+6=17
Write a code to find given number is divisible by each of its digit?
Example :- Number is 12 , so it is divisible with 12/1 and 12/2, both the digits.
Suppose there is one coin distribution ATM which contain 1Rs, 2Rs, 5Rs, 10Rs Coins and 50Rs, 100Rs and 500Rs Notes. Write a Program to find minimum entity when we withdraw some cash.
Ex:- for Rs 157 = 100 + 50 + 5 + 2 (Total 4)
for Rs 187 = 100 + 50 + 10(3) + 5 + 2 (Total 7)
Create two packages pac1 and pac2
create classes A and B in pac1 and classes D and E in pac2
Now put access modifier (public, private and default) in Class A so that
1 - We can Create Object of Class A from Class D and B
2 - We can Create Object of Class A from Class B only
3 - We cannot create Object of Class A from any class.
4 - We can create Object of Class A only from Class A.
[3rd and 4th problem will take constructor-access modifier concept in account].
Create two packages pac1 and pac2
create classes A and B in pac1 and classes D and E in pac2
Now put access modifier (public, private, protected and default) in Class A so that
1 - only D can use all methods of class A
2 - Object of Class A should not be created by any class(B, E, D) (except Class A). Well in Such Scenario how will you use methods from class A.
int x = 10
int y = x++ + ++x + ++x + x++ + x++ + x++ ;
x = ? and y = ?
which one is faster pre-increment or post-increment?
write an infinite for loop in 3 different way?
Create below number images using for loops