일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- msa개념
- coding test
- 웹개발
- MSA
- CSS
- BCIT
- DB
- SpringFramework
- two pointers
- 안드로이드
- Bambino
- jsp
- 리액트프로젝트
- 웹개발기초
- 웹개발자
- 자바
- 밤비노
- Java
- Programming
- 코드잇
- servlet
- MVC
- sql
- C
- mysql
- html
- jvm메모리구조
- job
- microservices
- 데이터베이스
- Today
- Total
초보 개발자의 기록
Java Review 본문
Java is an Object-Oriented programming language.
Object Oriented Programming?
OOP is a programming paradigm based on the concept of "Objects", which can contain data and code
OOP languages are diverse, but the most popular ones are class-based. meaaing that objects are instances of classes, which also determine thier types.
A programming methodology based on representing a program as a collection of objects, each of which is an instance of a certain class, and the classes form an inheritance hierarchy.
Everything in Java is associated with classes and objects, along with its attributes and methods.
What is a class in Java?
A Class is like an object constructor, or a "blueprint" for creating objects.
the basic element of object-oriented programming
Create a Class
How do I declare a class in code?
A Class should always start with an uppercase first letter,
and that the name of the Java file should match the class name
class MyClass {}
public class Main {
int x = 5
}
Create an Object
in Java, an object is created from a class.
public class Main {
int x = 5;
public static void main(String[] args) {
Main myObj = new Main();
System.out.println(myObj.x);
}
}
What does the NEW operator do?
To create an object, specify the class name, followed by the object name, and use the keyword new.
To create an instance of a class.
What does the extends keyword mean?
The extends keyword extends a class( indicates that a class is ingerited from another class)
it is possible to inherit attributes and methods from one class to another.
That the given class is inherited from another.
"inheriteance concept"
-subclass(child) : the class that inherits from another class
-superclass(parent) - the class being inhrited from
To inherited from a class, use the extends keyword.
What does method overloading mean?
Several methods with the same name but different set of parameters.
multiple methods can have the same name with different parameters.
Instead of defining two methods that should do the same thing, it is better to overload one.
What does overriding a method mean?
Overriding is a feature that allows a subclass or child class to provide a specofos implementation of a method that is already provided by one of its super classes or parent classes.
Changing the behavior of a class method relative to its parent.
Java program that have either static or public attributes and methods.
How a static class method differs from a regular class method?
A static method means that it can be accessed without creating as object of the class, unlike public which can only be accessed by objects.
A static methods belongs to the class itself while a non-static method belongs to each instance of a class.
Therefore, a static method can be called directly without creating any instance of the class and an objects is needed to call a non-static method.
Cannot access non-static member variables (instance member variables) from a static methods can only access static variables while non-static methods can access both static and non-static variables.
Cannot override
A regular class method works from a class object, and a static method works from the entire class.
The memory allocated to the Static area has the advantage of being shared by all objects and refernecing a member anywhere, But it exists outside the management area of the Garbage Collector, members in the Static area remain allocated memory until the end of the program.
How do I call a static method inside a regular one?
you can, you don't need to do anything extra.
The static method automatically created when the class goes up to the memory.
What is the keyword "this" for?
It is a pointer to the current class object within the class itself.
It can be omitted when calling a class method, but it is better not to.
this keyword is a refernece veriable that refers to the current object og a method or a constructor.
The main purpose of using this keyword in Java is to remove the confusion between class attributes and parameters that have same names.
'Coursera > Java Spring Framework' 카테고리의 다른 글
History of the Spring Framework (0) | 2021.01.28 |
---|