answersLogoWhite

0

I suppose you mean "encapsulation". It basically refers to "information hiding". That is, in a class, the details of how information is stored is hidden from the outside.

Here is a typical example in Java:

class Person {

private int age;

public int getAge() {return age;}

public void setAge(int parameterAge) {age = parameterAge;}

}

Note that the field (or variable) "age" is declared as "private"; that means that it can't be accessed directly from the outside, and the programmer of this class is free to change the way the information is stored at any moment, without breaking compatibility with any code that uses the class. Access to the information is via the public "get" and "set" methods; the signature of these methods should not change.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What are some example for string formatting in Java?

There are lots of examples of string formatting in Java. It can be difficult at times. Some of these examples are, but are not limited to; align, string, format, and JAVA.


What are Perl PHP and Java Servlet's?

Perl, php and Java are all examples of programming languages.


C plus plus and java are examples of what languages?

They are not examples of languages. They arelanguages.


What is subroutine in java?

Subroutine mean what (in java)?


What are the examples of assembly languages?

Fortran & Pascal


What does Systemout mean in java?

System.out refers to the Java console.


What are the examples of Java script?

validation of forms, date & time.


What are the examples of object oriented programming environments?

Java, C++


What are the different java technologies?

There are several types of Java technology. Some examples of Java software are Java ME, Java EE, Java SE, and Java Card. Java made the JAVA development kit for those that develop in Java. There is also Java Virtual machine and some class libraries. Java is also famous for its languages like Clojure, Beanshell, Groovy, Gosu, Rhino, Kotlin, JRuby, Scala, and Jython.


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


What does the word java mean?

Java is an island in Indonesia, but in slang it means coffee.


What does the term Java logging mean?

Java logging is data logging for the Java platform. Logging is a term in software for recording activity. Therefore Java logging is recording activity for Java.