Tutorials for Core Java beginners

Ads

 
 

Share on Google+Share on Google+

Naresh
Tutorials for Core Java beginners
1 Answer(s)      9 years ago
Posted in : Java Beginners

Can anyone share their example of Encapsulation in java? I'm a core Java beginner.

Ads
View Answers

February 24, 2008 at 7:15 PM


Hi,

Here is the description of Encapsulation in java:

Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.

In other words, encapsulation is the ability of an object to be a container (or capsule) for related properties (ie. data variables) and methods (ie. functions).


public class Box
{
// what are the properties or fields
private int length;
private int width;
private int height;

// what are the actions or methods
public void setLength(int p)
{length = p;}

public void setWidth(int p)
{width = p;}

public void setHeight(int p)
{height = p;}

public int displayVolume()
{System.out.println(length*width*height)...
}

public static void main(String args [ ])
{
Box b1=new Box(3,4,5);
b1.displayvolume();
}


Thanks

Ads









Related Tutorials/Questions & Answers:
Good tutorials for beginners in Java
Good tutorials for beginners in Java   Hi, I am beginners in Java... in details about good tutorials for beginners in Java with example? Thanks.   ... the various beginners tutorials related to Java http://www.roseindia.net/java/beginners
Which is the best Java tutorials for beginners?
Which is the best Java tutorials for beginners?  Hello, I am trying to find good tutorials for beginners. Which is the best Java tutorials... Tutorial for Beginners. This tutorial is best for learning Java. Beginners
Advertisements
Java programming for beginners video tutorials
Java programming for beginners video tutorials  Hi, I am trying to find the Java programming for beginners video tutorials. Let's know the url... for Java beginners. All the tutorials contains free examples. Thanks
tutorials - Java Beginners
tutorials  may i get tutorials for imaging or image processing in java  Hi friend, Please explain problem in details what you want with image in java. Thanks
Core Java tutorial for beginners
Core Java tutorials for beginners makes its simpler for novices... that programmer will find useful in learning the language. Each Core Java tutorials... understand every aspect of Core Java. Simple explanations to complex tutorials
Java Programming Tutorials for beginners
Java Programming tutorials for beginners are made in such a way... to explore: Java Video Tutorials for beginners Java tutorials for beginners with examples Java tutorials for beginners using eclipse
Java Video Tutorials for beginners
Java Video Tutorials for beginners are being provided at Roseindia online for free. These video tutorials are prepared by some of the best minds of Java... contains advance Java tutorials that are designed to help Java professionals
Java tutorials for beginners with examples
Java Video tutorials with examples are being provided to help the beginners..., methods, interface, variables, etc. Java tutorials for beginners with examples... and easiest way is to learn Java online. At Roseindia Java tutorials and Java
core java - Java Beginners
core java  i want to get java projects in core java
Complete Java programming tutorials for beginners
Complete collection of Java programming tutorials for beginners is available... programming. These programming tutorials have a vast collection of Java... programming is through online Java tutorials. The first benefit is that it is free
Core Java - Java Beginners
://www.roseindia.net/software-tutorials/detail/10992 visit www.roseindia.net/java...Core Java  Can u give real life and real time examples of abstraction, Encapsulation,Polymarphism....?  I guess you are new to java and new
core java - Java Beginners
Core Java interview Help   Core Java interview questions with answers  Hi friend,Read for more information.http://roseindia.net/interviewquestions
JAVA(core) - Java Beginners
JAVA(core)  Core Java  In java 'null' is keyword which means object have nothing to store. even not allocated memory
Core Java - Java Beginners
Core Java  What is Java? I am looking for Core Java Training  Hi friendThe Core Java Technologies and application programming interface... Microsystems. We generally introduce java in two ways, core java and advance java
core Java - Java Beginners
core Java  how is it possible to create object before calling main() in Java
core java - Java Beginners
core java  how many keywords are in java? give with category? .../java/language/java-keywords.shtml http://www.roseindia.net/java/master-java/java-keywords.shtml Thanks
core java - Java Beginners
core java  what is object serialization ? with an example   Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/io/SerializingObject.shtml Thanks
core java - Java Beginners
core java  hallo sir, in java ,int range is -128 to 127. what about '0' indicate what  Hi, In java byte range is -128 to 127, not of int
java tutorials
java tutorials  Hi, Much appreciated response. i am looking for the links of java tutorials which describes both core and advanced java concepts... one stop material which discusses each and every concept of core and advanced
core java - Java Beginners
core java  how to write a simple java program?  Hi friend..."); } } ------------------------------------------- Read for more information. http://www.roseindia.net/java/master-java/index.shtml Thanks
core java - Java Beginners
core java   what is the difference b/w #include and import??  Hi Friend, Do you want the difference b/w '#include in C' and 'import in java'? Thanks
core java - Java Beginners
core java  what is thread ? i can't understand it's need?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/thread/ Hope that it will be helpful for you. Thanks
Core java - Java Beginners
Core java  Hello sir/madam, Can you please tell me why multiple inheritance from java is removed.. with any example.. Thank you...://www.roseindia.net/java/master-java/inheritance.shtml Thanks  Hi
core java - Java Beginners
core java  can we write a program for adding two numbers without...-in-java/ it's about calculating two numbers Java Program Code for calculating two numbers http://www.roseindia.net/java/java-conversion/calculating-three
core java - Java Beginners
core java  when write java program in editplus.then save&compile the file. 1-text file 2-class file 3-bak file how can get this files plz tell me  Hi Friend, Please clarify your problem. Thanks
core java - Java Beginners
core java  Can we provide more than 1 try catch block  Hi Friend, Yes you can. For more information, please visit the following link: http://www.roseindia.net/java/exceptions/nested-try.shtml Thanks
core java - Java Beginners
core java  hi, what is the difference between method... and Overriding: http://www.roseindia.net/java/javascript-array/modified-java-method-overloading.shtml http://www.roseindia.net/java/javascript-array/modified-java
core java - Java Beginners
core java  can we define a function in java and answer is yes, then how we define a function in java pls provide code?  Hi Friend, class Numbers{ public int add(int num1,int num2) { return num1+num2
core java - Java Beginners
core java  When we will use marker interface in our application?  Hi friend, Marker Interface : In java language programming...://www.roseindia.net/java/master-java/interface.shtml Thanks
core java - Java Beginners
core java  hi.. one probledm from my end how we can perform the TaskSheduling in java ? coming to my project: Its is NMS domain My project is to collect Data from network and store the data in a FileSystem and after
core java - Java Beginners
core java  write a program to display equilateral traiangle using stars? output will be as follows: * * * * * * * * * * ...://www.roseindia.net/java/ Thanks

Ads

 
Advertisement null

Ads