|
blacksta (m)
|
To all java experts - can somebody please define abstractation and encapulation in java with examples - Thanks
|
|
|
|
|
|
ice_man
|
If you really want to learn stuff about java, i suggest u lay your hands on books like: thinking in java, or java how to program, They're available in pdf
|
|
|
|
|
|
SayoMarvel (m)
|
Please can you send me the pdf version of java how to program? Prefarably the 7th edition but if that is not available, you can send me any other edition of the book. u can upload it or send it to my e-mail. marvelindaclub@yahoo.com
|
|
|
|
|
|
linxon (m)
|
To all java experts - can somebody please define abstractation and encapulation in java with examples - Thanks
Abstraction and Encapsulation are quite similar and confusing when you start oops programming, but heres my explanation: Abstraction means hiding the internal details and just exposing the ‘relevant’ functionality (i.e. the interface). For Example:-When you change the gear of your car, you know the gears will be changed without knowing how they are functioning internally. Now I have not coded in Java for about a year but from the top of my head: public interface GearBox { int gearOne(); int gearTwo(); int gearThree(); int gearFour(); int gearFive(); int reverse(); int neutral(); } Encapsulation refers to the transparency of an object - information hiding. By hiding the information inside an object we prevent a client from making unauthorized modifications, why? it makes code more robust. For example: public class NaijaCar extends Car implements GearBox { public NaijaCar() { //init code here } private double acceleration = 1.0; //Now implement the interface public int gearOne() { super.speed += acceleration; } public int gearTwo() { super.speed += acceleration * 2.0; } //And so on for gear 2,3 and 4 public int gearFive() { super.speed += acceleration * 5.0; } public int reverse() { super.speed -= acceleration; } public int neutral() { super.speed = 0.0; } } So you can see the Abstraction in the sense that users of NaijaCar use all mthe relevant gearbox methods without knowing the deatils of how each one works. some homework for you, where is the encapsulation in NaijaCar?
|
|
|
|
|
|
blacksta (m)
|
As an object oriented programmer their are 4 principles or pillar you will need to understand and the rest is history
Pillar #1: Encapsulation Pillar #2: Inheritance Pillar #3: Polymorphism Pillar #4: Abstraction - some argue you only have the 3 top pillars
would anybody please give defination for the above - thanks
also thanks to Linxon ( wonderful example)
|
|
|
|
|
|
|
|
candylips (m)
|
u bumped the thread right.  in your last post you listed 4 core oo principles. Just to add also that it is good oo practice to favor Encapsulation vs Inheritance cos it allows for very flexible oo designs
|
|
|
|
|
|
Kobojunkie
|
Abstraction is definitely an OOP basic.
|
|
|
|
|
|
akinwunmi (m)
|
Helloooo
am about using Netbeans for Java programming. I would like to know if its like Visual Basic.net.
thanks
|
|
|
|
|
|
bigboyslim (m)
|
Abstraction - from the word abstract - meaning overview - As an analogy, when you read a technical document. There's always an abstract which gives a general overview of what the document is about.
In Object Oriented programming, Abstraction gives the specification of an Interface. i.e it gives the Name of the interface and the names of all the methods in the interface but not the details. Any class that plans to implement that interface must use the specified methods. You make use of the specified methods but you supply the details in each method yourself.
Encapsulation on the other hand refers to the fact that the when a user uses an object of a class, he has no ability to change the inner operations of the class methods and variables. That is the internal operations of the class is shielded protected or encapsulated.
|
|
|
|
|
|
bigboyslim (m)
|
Inheritance is the relationship between two classes that allows an object of one class called the sub class to use the methods already defined in another class called the super class. The syntax is
Class Subclass extends Superclass For example
Class Vehicle{
accelerate(); reverse (); changeGear();
}
Class SUV extends Vehicle{
// no need to specify the accelerate(). reverse(); and changeGear() methods. (except during method overriding)
}
Class Vehicle is the superclass while class SUV is the subclass. Class SUV inherits the methods of class Vehicle, therefore if you create an object of Class SUV and make it inherit from class Vehicle, you can call the methods of the superclass Vehicle without having to define them in the SUV object. The primary purpose of inheritance is code reuse. i.e you don't have to keep defining methods for each object you create.
|
|
|
|
|
|
candylips (m)
|
Helloooo
am about using Netbeans for Java programming. I would like to know if its like Visual Basic.net.
thanks
No where near as good as Visual Studio am afraid.
|
|
|
|
|
|
hymnha (m)
|
Hello. pls kindly assist me with this prob. I am introducing a password page to an application. But i'm stock in between pls cam somebody help me on how to go about it
|
|
|
|
|
|
blacksta (m)
|
;d Abstraction and Encapsulation are quite similar and confusing when you start oops programming, but heres my explanation:
Abstraction means hiding the internal details and just exposing the ‘relevant’ functionality (i.e. the interface). For Example:-When you change the gear of your car, you know the gears will be changed without knowing how they are functioning internally. Now I have not coded in Java for about a year but from the top of my head:
public interface GearBox { int gearOne(); int gearTwo(); int gearThree(); int gearFour(); int gearFive(); int reverse(); int neutral(); }
Encapsulation refers to the transparency of an object - information hiding. By hiding the information inside an object we prevent a client from making unauthorized modifications, why? it makes code more robust. For example:
public class NaijaCar extends Car implements GearBox { public NaijaCar() { //init code here } private double acceleration = 1.0; //Now implement the interface public int gearOne() { super.speed += acceleration; }
public int gearTwo() { super.speed += acceleration * 2.0; } //And so on for gear 2,3 and 4 public int gearFive() { super.speed += acceleration * 5.0; } public int reverse() { super.speed -= acceleration; } public int neutral() { super.speed = 0.0; } }
So you can see the Abstraction in the sense that users of NaijaCar use all mthe relevant gearbox methods without knowing the deatils of how each one works. some homework for you, where is the encapsulation in NaijaCar?
public class NaijaCar extends Car implements GearBox { public NaijaCar() { //init code here } private double acceleration = 1.0; //Now implement the interface public int gearOne() The field decleared private cant not be accessed by anyone outside of the class
|
|
|
|
|
|
puskin
|
@blacksta Seeing U r a java programmer. I nid your help. I am making a career change in2 programming, so I nid all d help I can get. I am hoping U nd others alike will b of assistance 2me. Pls, i wud b grateful if U cud assist me with some Java ebooks 4beginners nd also d compiler or U cud just paste d sites/links whr I can dwnld them 4rm. Thanks.
|
|
|
|
|
|
Evagreenfields (f)
|
Helo people.plx can i get d rough estimate of being a sun java certified programmer/developer and how long it takes to run the programme,all tins being equal.tanx
|
|
|
|
|
|
zap2 (m)
|
@ iceman, pls how can i get pdf on how to progran java, pls send it to my netfreakz@gmail.com. tnx
|
|
|
|
|
|
|
|
blacksta (m)
|
Helo people.plx can i get d rough estimate of being a sun java certified programmer/developer and how long it takes to run the programme,all tins being equal.tanx
Are u talking about a self study route or Attending a college >
|
|
|
|
|
|
Evagreenfields (f)
|
Self study,@blacksta,i just want to read up java programming books and then sit 4 the programming exam,
|
|
|
|
|
|
uche1 (m)
|
Hello All @Blacksta, plz can u help me out with this assignment. How java handles graphic and example of simple program to effect it. post it here or u can send it to my mail bloomstech@yahoo.comwaiting for your reply. Thanks
|
|
|
|
|
|
freeze1982
|
:'(hello moderator and all nairaland fan,i'm a graduate of mathematics/computer sci. After my graduation i decide 2 learn JAVA programming to boost my knowledge.but the language is difficult.i hav decide 2 pick it up,4rm 2moro.i need help my email is bluediva555@yahoo.com,pls if u hav any codes 2 assist me i'll be glad. 
|
|
|
|
|
|
kencas
|
Data abstraction means hiding some data elements of a class from the public
class Student { private String regNo; private String name;
public void setRegno(String regNo) { this.regNo= regNo; }
public String getRegno() { return regNo; }
public void setName(String name) { this.name= name; }
public String getName() { return name; }
}
Hoope this explains the concept
|
|
|
|
|
|
Everything
|
How java handles graphic and example of simple program to effect it.
Familiarize yourself with the Java 2D API. It's a whole lot of package. You'll see lots of (hands-on) examples while learning!!! Visit http://www.corewebprogramming.com/PDF/ch10.pdf for Java 2D tutorial.
|
|
|
|
|
|
blacksta (m)
|
JAVA BOOKS FOR DOWNLOAD Java Examples in a Nutshell, 3rd Edition By David Flanagan * Publisher: O'Reilly Media, Inc. * Number Of Pages: 720 * Publication Date: 2004-01-01 * ISBN-10 / ASIN: 0596006209 * ISBN-13 / EAN: 9780596006204 * Binding: Paperback Product Description: The author of the best-selling Java in a Nutshell has created an entire book of real-world Java programming examples that you can learn from. If you learn best "by example," this is the book for you. This third edition covers Java 1.4 and contains 193 complete, practical examples: over 21,900 lines of densely commented, professionally written Java code, covering 20 distinct client-side and server-side APIs. It includes new chapters on the Java Sound API and the New I/O API. The chapters on XML and servlets have been rewritten to cover the latest versions of the specifications and to demonstrate best practices for Java 1.4. New and updated examples throughout the book demonstrate many other new Java features and APIs. Java Examples in a Nutshell is a companion volume to Java in a Nutshell, Java Foundation Classes in a Nutshell, and Java Enterprise in a Nutshell. It picks up where those quick references leave off, providing a wealth of examples for both novices and experts. This book doesn’t hold your hand; it simply delivers well-commented working examples with succinct explanations to help you learn and explore Java and its APIs. http://w14.easy-share.com/1702920065.html
|
|
|
|
|
|
blacksta (m)
|
Thinking in Java By Bruce Eckel * Publisher: Prentice Hall PTR * Number Of Pages: 1098 * Publication Date: 1998-02-19 * ISBN-10 / ASIN: 0136597238 * ISBN-13 / EAN: 9780136597230 * Binding: Paperback Product Description: The legendary author Bruce Eckel brings Java to life with this extraordinarily insightful, opinionated and downright funny introduction. Thinking in Java introduces all of the language's fundamentals, one step at a time, using to-the-point code examples. More than virtually any other book, Thinking in Java helps you understand not just what to do -- but why. Eckel introduces all the basics of objects as Java uses them; then walks carefully through the fundamental concepts underlying all Java programming -- including program flow, initialization and cleanup, hiding implementations, reusing classes and polymorphism. Using extensive, to-the-point examples, he introduces error handling, exceptions, Java I/O, run-time type identification, and passing and returning objects. He covers the Java AWT, multithreading, network programming with Java -- even design patterns. The best way to understand the real value of this book is to hear what readers of the online version have been saying about it: "much better than any other Java book I've seen, by an order of magnitude, " "mature, consistent, intellectually honest, well-written and precise, " "a thoughtful, penetrating analytical tutorial which doesn't kowtow to the manufacturers, " "Thank you again for your awesome book. I was really floundering, but your book has brought me up to speed as quickly as I could read it!"For both beginner and experienced C and C++ programmers who want to learn Java. * From the basics of object development, all the way to design patterns and other advanced topics. * By the author of the best-selling Thinking in C++ -- winner of the 1995 Jolt Cola Award! * On-line version has already received tens of thousands of hits -- there's a huge built-in demand for this book! Download Links: Code: http://www.megaupload.com/?d=177J8HKO
|
|
|
|
|
|
blacksta (m)
|
Head First Java, 2nd Edition By Kathy Sierra, Bert Bates * Publisher: O'Reilly Media, Inc. * Number Of Pages: 720 * Publication Date: 2005-02-09 * ISBN-10 / ASIN: 0596009208 * ISBN-13 / EAN: 9780596009205 * Binding: Paperback Product Description: Learning a complex new language is no easy task especially when it s an object-oriented computer programming language like Java. You might think the problem is your brain. It seems to have a mind of its own, a mind that doesn't always want to take in the dry, technical stuff you're forced to study. The fact is your brain craves novelty. It's constantly searching, scanning, waiting for something unusual to happen. After all, that's the way it was built to help you stay alive. It takes all the routine, ordinary, dull stuff and filters it to the background so it won't interfere with your brain's real work--recording things that matter. How does your brain know what matters? It's like the creators of the Head First approach say, suppose you're out for a hike and a tiger jumps in front of you, what happens in your brain? Neurons fire. Emotions crank up. Chemicals surge. Download Links: Code: http://www.megaupload.com/?d=RBKQ55WY
|
|
|
|
|
|
blacksta (m)
|
If u need more books or certification exam notes let me know
|
|
|
|
|
|
ikmomen (m)
|
@blacksta, pls can i get a book for newbie programmers
|
|
|
|
|
|
blacksta (m)
|
@blacksta, pls can i get a book for newbie programmers
Try the head first Java series very good for newbies
|
|
|
|
|
|
candylips (m)
|
head first  what of mouth first 
|
|
|
|
|
|