0% found this document useful (0 votes)
15 views1 page

John Michael Nobleza ICT 1101 Activity 1

The document discusses access modifiers in Java including default, public, private and protected. It provides examples of how each access modifier can be used with variables, methods, classes and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

John Michael Nobleza ICT 1101 Activity 1

The document discusses access modifiers in Java including default, public, private and protected. It provides examples of how each access modifier can be used with variables, methods, classes and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

John Michael Nobleza ICT 1101

Activity 1

1. Default Access Modifier


2. Public Access Modifier
3. Private Access Modifier
4. Protected Access Modifier

Activity 2

1. The default access modifier implies that we do not specifically declare a class, field, process, etc.
access modifier.
2. Only within the declared class itself can methods, variables, and constructors are declared
private be accessed.
3. Variables, methods, and constructors declared to be protected in a superclass can only be
accessed by subclasses in another package or by any class inside the protected members' class
package.
4. It is possible to access a class, function, constructor, interface, etc. declared public from any
other class.

Activity 3

1. String texture = "Soft";


}
2. public class Age {
private int age = 17;
}
3. public class Logger {
public String name;

public String getName() {


return this.name;
}
public void setName(String name) {
this.name = name;
}
}
4. class LRN {
protected String LRN;
}
5. String mobileNum = "Number";
}

You might also like