Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java Private Access Modifier

class Data {
    // private variable
    private String name;
}

public class Main {
    public static void main(String[] main){

        // create an object of Data
        Data d = new Data();

        // access private variable and field from another class
        d.name = "Programiz";
    }
}
Comment

Java Protected Access Modifier package one

// Java program to illustrate
 protected modifier
package one;

// Class A
public class A
{
protected void display()
	{
		System.out.println("Welcome to softhunt.net");
	}
}
Comment

Java Protected Access Modifier package two

// Java program to illustrate
 protected modifier
package two;
import one.*; // importing all classes in package one
 
// Class B is subclass of A
class B extends A
{
public static void main(String args[])
{
    B obj = new B();
    obj.display();
}
   
}
Comment

Java Public Access Modifier package one

// Java program to illustrate
 public modifier
package one;
public class A
{
public void display()
    {
        System.out.println("Welcome to softhunt.net");
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: convert kotlin to java online editor 
Java :: crud repository count number of items in a list 
Java :: test date in java 
Java :: how do I change the opacity of a JButton 
Java :: what is abstract class 
Java :: display pop up window overlay permission in redmi android studio 
Java :: string in java 
Java :: java nested for loop 
Java :: enhanced for loops 
Java :: throw keyword in java 
Java :: java digit in number 
Java :: okhttp3, android okhttp 
Java :: android list to string 
Java :: top easiest languages programming to learn 
Java :: Java getClass() method 
Java :: searchview android example recyclerview 
Java :: can you use java in unity 
Java :: how to stop screen going off android studio 
Java :: what is java steam 
Java :: java game development course free 
Java :: how to make character in jframe 
Sql :: mysql how to truncate table with foreign keys 
Sql :: mysql list bigger table 
Sql :: mysql alter column default 
Sql :: list all triggers in sql server 
Sql :: mariadb select multiple rows into one column 
Sql :: find largest table in mysql database 
Sql :: sql server: query to find out all the places where the table is used 
Sql :: mysql connectorj maven de 
Sql :: mysql show table character set 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =