'Back-End'에 해당되는 글 135건

donaricano-btn

Encapsulation

- Encapsulation is a process of wrapping code and data together into a single unit

- We can create a fully encapsulated class by making all the data members of the class private

- Java Bean class is the example of fully encapsulated class


1. Advantage

- You can make the class read-only or write-only

- It provides you the control over the data

2. Example


'Back-End > Java_1' 카테고리의 다른 글

[Java] Multithreading in java  (0) 2016.10.05
[Java] Call by value  (0) 2016.09.13
[Java] Package  (0) 2016.09.12
[Java] Interface  (0) 2016.09.12
[Java] Abstract class  (0) 2016.09.12
블로그 이미지

리딩리드

,

[Java] Package

Back-End/Java_1 2016. 9. 12. 14:48
donaricano-btn

 Package

- Package is a group of similar types of classes, interface and sub-packages

- built-in package(java, lang, awt, javax...) and user-defined package


1. Advantage of Java Package

- Java package is used to categorize the classes and interface so that they can be easily maintained

- It provides access protection

- It removes naming collision

2. How to compile and run java package

1) compile


2) run

 


'Back-End > Java_1' 카테고리의 다른 글

[Java] Call by value  (0) 2016.09.13
[Java] Encapsulation  (0) 2016.09.12
[Java] Interface  (0) 2016.09.12
[Java] Abstract class  (0) 2016.09.12
[Java] Instanceof  (0) 2016.09.09
블로그 이미지

리딩리드

,

[Java] Interface

Back-End/Java_1 2016. 9. 12. 14:00
donaricano-btn

Interface

interface is a blueprint of a class

- It has static constants and abstract methods only

- It is used to achieve fully abstraction and multiple inheritance in java


1. Why use it

- It is used to achieve fully abstraction

- By interface, we can support the functionality of multiple inheritance

- It can be used to achieve loose coupling

- The java compiler adds public and abstract keywords before the interface method and public, static and final keywords before data members

2. Example


3. Multiple inheritance 

 

1) Is it possible by interface, why?

- There is no ambiguity as implementation is provided by the implementation class

4. What is marker or tagged interface?

- An interface that have no member is known as marker or tagged interface

- Serializable, Cloneable, Remote....

- They are used to provide some essential information to the JVM so that JVM may perform some useful operation

 


'Back-End > Java_1' 카테고리의 다른 글

[Java] Encapsulation  (0) 2016.09.12
[Java] Package  (0) 2016.09.12
[Java] Abstract class  (0) 2016.09.12
[Java] Instanceof  (0) 2016.09.09
[Java] Static Binding and Dynamic Binding  (0) 2016.09.08
블로그 이미지

리딩리드

,
donaricano-btn

Abstract class

- A class that is declared with abstract keyword, is known as abstract class

- It can have abstract and non-abstract methods


1. Abstraction in java

- Abstraction is a process of hiding the implementation details 

- It showing only functionality to the user

- Abstraction lets you focus on what the object does instead of how it does it


1) Ways to achieve Abstraction

- Abstract class

- Interface

2. Example

3. Abstract class having constructor, data member, methods

- If there is any abstract method in a class, that class must be abstract

- If you are extending any abstract class that have abstract method, you must either provide the implementation of the method or make this class abstraction



'Back-End > Java_1' 카테고리의 다른 글

[Java] Package  (0) 2016.09.12
[Java] Interface  (0) 2016.09.12
[Java] Instanceof  (0) 2016.09.09
[Java] Static Binding and Dynamic Binding  (0) 2016.09.08
[Java] Runtime Polymorphism  (0) 2016.09.08
블로그 이미지

리딩리드

,