'Back-End/Java_1'에 해당되는 글 48건

donaricano-btn

 Method Overloading

If a class have multiple methods by same name but different parameters, it is known as Method Overloading


1. Advantage of method overloading

- Method overloading increases the readability of the program


2. Different ways to overloading the method

2_1. By changing number of arguments

2_2. By changing the data type


1) By changing the number of arguments



2) By changing the data type

 


3. Questions

3_1. Why method overloading is not possible by changing the return type of method?

- there may occur ambiguity.


3_2. Can we overloading main() method?

  

- Yes

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

[Java] Static_2  (0) 2016.07.26
[Java] Constructor_2  (0) 2016.07.26
[Java] Object and Class  (0) 2016.06.27
[Java] Java OOPs Concepts  (0) 2016.06.27
[Java] Json  (0) 2016.06.15
블로그 이미지

리딩리드

,
donaricano-btn

  Object and Class


- Object is the physical as well as logical entity

- Class is the logical entity only


1. Object in java

- An entity that has state and behavior is known as an object

- An object has three characteristics

1_1. state: represents data(value) of an object

1_2. behavior : represents the behavior(functionality) of an object such as deposit, withdraw

1_3. identity : Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But is is used internally by the JVM to identify each object uniquely


- Object is an instance of a class

: Class is a template or blueprint from which objects are created


2. Class in Java

- A class is a group of objects that has common properties. It is a template or blueprint from which objects are created

- A class in java can contain

        • data member
        • method
        • constructor
        • block
        • class and interface

2_1. new Keyword

- The new keyword is used to allocate memory at runtime


3. Example

- Object gets the memory in Heap area and reference variable refers to the object allocated in the Heap memory area

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

[Java] Constructor_2  (0) 2016.07.26
[Java] Method Overloading  (0) 2016.07.25
[Java] Java OOPs Concepts  (0) 2016.06.27
[Java] Json  (0) 2016.06.15
[Java] UnicodeSystem  (0) 2016.06.10
블로그 이미지

리딩리드

,
donaricano-btn

 Java OOPs Concepts


1. OOPs(Object Oriented Programming System)

- Object means a real world entity such as pen, chair, table, etc..

- OOPs is a methodology or paradigm to design a program using classes and objects

- Object, Class, Inheritance, Polymorphism, Abstaraction, Encapsulation


1_1. Object 

- Any entity that has state and behavior is known as an object


1_2. Class

- Collection of objects 


1_3. Inheritance

- When on object acquires all the properties and behaviours of parent object

- It provides code reusability. It is used to achieve runtime polymorphism


1_4. Polymorphism

- When one task is performed by different ways i.e. known as polymorphism

- In java, we use method overloading and method overriding to achieve polymorphism


1_5. Abstraction

- Hiding internal details and showing functionality

- In java, we use abstraction class and interface to achieve abstraciton


1_6. Encapsulation

- Binding (or wrapping) code and data together into a single unit 

- A java class is the example of encapsulation, Java bean is the fully encapsulated class

because all the data members are private here


2. What is difference between object-oriented programming language and object-based programming language(Javascript)?

- Object based programming language follows all the features of OOPs except Inheritance.





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

[Java] Method Overloading  (0) 2016.07.25
[Java] Object and Class  (0) 2016.06.27
[Java] Json  (0) 2016.06.15
[Java] UnicodeSystem  (0) 2016.06.10
[Java] JVM  (0) 2016.06.03
블로그 이미지

리딩리드

,

[Java] Json

Back-End/Java_1 2016. 6. 15. 21:43
donaricano-btn

Json

- The json.simple library allows us to read and write JSON data in Java. In other words, we can encode and decode JSON Object in java using json.simple library


1. Install json.simple

- Download json-simple.jar, or


2. Java JSON Encode


3. Java Json Encode using map


4. Java JSON Array Encode


5. Java JSON Array Encode using List


6. Java JSON Decode






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

[Java] Object and Class  (0) 2016.06.27
[Java] Java OOPs Concepts  (0) 2016.06.27
[Java] UnicodeSystem  (0) 2016.06.10
[Java] JVM  (0) 2016.06.03
[Java] JDK, JRE, and JVM  (0) 2016.06.03
블로그 이미지

리딩리드

,