java interview Questions
4.23K subscribers
61 photos
23 files
159 links
java interview questions for beginners
Any promotion for
rajp6133@gmail.com
Download Telegram
Multiple Inheritance in Java
https://cjavapoint.blogspot.com/?m=1
*Static Nested Class*

1) Static Nested ClassIn java static nested class is a class which is defined in a class with static keyword.


static nested class cannot access non-static data member and methods of outer class. It can access only static data member of outer class including private.

 Java Static Nested Class Example

class Simple
{
static int a = 700;
static class SimpleInner
{
void show()
{
System.out.println("value is"+a);
}
}
public static void main(String args[])
{
Simple.SimpleInner s = new Simple.SimpleInner();
s.show();
}
}
https://cjavapoint.blogspot.com/?m=1
👍1
*Inner Class In Java*

Java inner class is a class which is defined in another class(outer class) is known as inner class or nested class in java.
 
*Syntax of Inner class or nested class :*
 
class OuterClass_Name
{
-----
-----
-----
class InnerClass_Name
{
-----
-----
-----
}


Java inner classes or nested classes can access all the data members and methods of its outer class including private data member and private methods.

There are a great relationship between java inner class and its outer class's instance.

Inner class is a part of nested class, non-static classes is known as inner class in java. 

Types of Nested Class

There are two types of nested class, non-static nested class and static nested class. The non-static nested class is known as inner class in java.


*(1) non-static nested class(inner class)*

1. member inner class

2. anonymous inner class

3. local inner class

*(2) static nested class*

4. static nested class
https://cjavapoint.blogspot.com/?m=1
*Java Collections*

Collections in java is a framework. A collection allows a "group of objects to be treated as single unit". These objects can be stored, retrieved, and manipulated as a elements of collection.

Some collection allow duplicate elements and others do not. Some collection are ordered and others unordered. 


*What is Framework ?*

Framework provides readymade architecture.Framework represents set of classes and interfaces.


*What is Collection* 

Collection represents group of objects as single unit. Java collection framework introduced in J2SE 1.2 released. Collections are set of classes and interfaces.


By using collection, You can perform operations on data such as insertion, deletion, searching, sorting and manipulation easily. Collection is an alrternate of an java array

*What is Collection Framework in Java* 

Collection framework in java is a unified architecture for storing and manipulating collections i.e group of objects. Java collection framework contains :

1.Interfaces
2.Interfaces implementer classes
3.Algorithm

Collection framework basically used to handle the data structure in java programming language.

Java collections framework provides  many interfaces and classes, these are :

*Package :*

java.util package 

*Classes :*

ArrayList
LinkedList
Vector
HashSet
LinkedHashSet
TreeSet
PriorityQueue


*Interfaces :*

Collection
List
Set
Queue
Dequeue


*Hierarchy of Collection Framework*

The java.util package contains all the classes and interfaces for the collection framework in java. When we wil make any collection program, we have to import java.util package in that program.
👍1
Core java Opps concept book download
Kese Ho Sab Java Walo
Anonymous Poll
50%
Badiya
27%
Ache
23%
Bhut badiya
*Inner Class In Java*

Java inner class is a class which is defined in another class(outer class) is known as inner class or nested class in java.
 
*Syntax of Inner class or nested class :*
 
class OuterClass_Name
{
-----
-----
-----
class InnerClass_Name
{
-----
-----
-----
}


Java inner classes or nested classes can access all the data members and methods of its outer class including private data member and private methods.

There are a great relationship between java inner class and its outer class's instance.

Inner class is a part of nested class, non-static classes is known as inner class in java. 

Types of Nested Class

There are two types of nested class, non-static nested class and static nested class. The non-static nested class is known as inner class in java.


*(1) non-static nested class(inner class)*

1. member inner class

2. anonymous inner class

3. local inner class

*(2) static nested class*

4. static nested class
For more information visit:-
https://cjavapoint.blogspot.com/?m=1
*Java Collections*

Collections in java is a framework. A collection allows a "group of objects to be treated as single unit". These objects can be stored, retrieved, and manipulated as a elements of collection.

Some collection allow duplicate elements and others do not. Some collection are ordered and others unordered. 


*What is Framework ?*

Framework provides readymade architecture.Framework represents set of classes and interfaces.


*What is Collection* 

Collection represents group of objects as single unit. Java collection framework introduced in J2SE 1.2 released. Collections are set of classes and interfaces.


By using collection, You can perform operations on data such as insertion, deletion, searching, sorting and manipulation easily. Collection is an alrternate of an java array

*What is Collection Framework in Java* 

Collection framework in java is a unified architecture for storing and manipulating collections i.e group of objects. Java collection framework contains :

1.Interfaces
2.Interfaces implementer classes
3.Algorithm

Collection framework basically used to handle the data structure in java programming language.

Java collections framework provides  many interfaces and classes, these are :

*Package :*

java.util package 

*Classes :*

ArrayList
LinkedList
Vector
HashSet
LinkedHashSet
TreeSet
PriorityQueue


*Interfaces :*

Collection
List
Set
Queue
Dequeue


*Hierarchy of Collection Framework*

The java.util package contains all the classes and interfaces for the collection framework in java. When we wil make any collection program, we have to import java.util package in that program.

https://cjavapoint.blogspot.com/?m=1
import java.util.Scanner;

public class FibonaciiSeries
{

public static void main(String[] args)
{
    Scanner s=new Scanner(System.in);
    System.out.println("Enter Number");
    int x=s.nextInt();
    int fib[]=new int [x];
    fib[0]=0;
    fib[1]=1;
    for(int i=2;i<x;i++)
    {
    fib[i]=fib[i-1]+fib[i-2];
    }
   for(int se:fib)
   {
    System.out.print(se+" ");
   }
}

}
https://cjavapoint.blogspot.com/?m=1
import java.util.Arrays;
import java.util.LinkedHashSet;

public class ArrayExample
{
    public static void main(String[] args) throws CloneNotSupportedException
    {
        //Array with duplicate elements
        Integer[] numbers = new Integer[] {1,2,3,4,5,1,3,5};
        
        //This array has duplicate elements
        System.out.println( Arrays.toString(numbers) );
        
        //Create set from array elements
        LinkedHashSet<Integer> linkedHashSet = new LinkedHashSet<>( Arrays.asList(numbers) );
        
        //Get back the array without duplicates
        Integer[] numbersWithoutDuplicates = linkedHashSet.toArray(new Integer[] {});
        
        //Verify the array content
        System.out.println( Arrays.toString(numbersWithoutDuplicates) );
    }
}
https://cjavapoint.blogspot.com/?m=1
1
import java.util.Scanner;

public class FibonaciiSeries
{

public static void main(String[] args)
{
    Scanner s=new Scanner(System.in);
    System.out.println("Enter Number");
    int x=s.nextInt();
    int fib[]=new int [x];
    fib[0]=0;
    fib[1]=1;
    for(int i=2;i<x;i++)
    {
    fib[i]=fib[i-1]+fib[i-2];
    }
   for(int se:fib)
   {
    System.out.print(se+" ");
   }
}

}
https://cjavapoint.blogspot.com/?m=1