Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java Private Access Modifier Error when we call it

// Java program to illustrate error while
 using class from different package with
 private modifier
package one;

class A
{
private void display()
	{
		System.out.println("Welcome to softhunt.net");
	}
}

class B
{
public static void main(String args[])
	{
		A obj = new A();
		// Trying to access private method
 of another class
		obj.display();
	}
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Java #Private #Access #Modifier #Error #call
ADD COMMENT
Topic
Name
8+4 =