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