[Java] Basic terms in programming

Programming study diary

November 4, 2020 I will re-study Java from scratch as a review. So, first, let's review the basic terms.

Classes and methods

Classes and methods are described as follows. (Details will be explained below)

class class name{
Method name(argument){
    //Execution process
Method body
  }
}

class

Simply put, a class is like a blueprint that summarizes the processing required to execute a program, consisting of methods and variables. In an object-oriented language like Java, the object of programming is regarded as an object (thing). So a class is a blueprint for an object, but not the object itself. Therefore, when using a class, it is necessary to create (= instantiate) an object.

To be able to use a class, you must define it. A field is a defined variable inside the class and stores the information that the class has. The object is a collection of fields and methods.

Class definition


class class name{
  //Describe fields, methods, etc.
}

Method

Simply put, a method describes the functionality of a class and consists of the method name, arguments, and the method body. As mentioned above, the object created to use the class consists of elements called attributes and methods. You can create your own methods, but many are pre-made. Multiple methods can be described in one class.

Object and object orientation

A class is a blueprint, and an object is like a part created based on that blueprint. An object is a materialized (= instantiated) class, and in order to use the object, the following description must be made.

Use objects


Class name variable name=new class name(argument);

Objects have the meaning of "things," and the idea of building a system by combining objects like parts is called object-oriented.

Inheritance

Inheriting the fields and methods of a specific class to define a new class is called inheritance. When inheriting, the original class is called a superclass, and the newly created class is called a subclass.

Class inheritance


class Subclass name extends Superclass name{
  //Processing content, method
}

override

Redefining a superclass method in a subclass is called overriding. When calling the overridden method, write as follows. (Methods with modifiers such as final and static cannot be overridden)

override


super.Method name;

Overload

It is not possible to define the same method name in the same class, but the mechanism that allows multiple methods with the same name to be defined by the argument type and sorting is called overload.

References

Introduction to Java: Essential Knowledge of Programming! Basic Glossary I Want to Hold First [Introduction to Java] Compiling, classes, methods ... Summary of basic terms you want to hold

Recommended Posts

[Java] Basic terms in programming
Constraint programming in Java
[Java] Basic terms in programming
Organize compareTo
Implement Basic authentication in Java
Use OpenCV_Contrib (ArUco) in Java! (Part 2-Programming)
Ruby basic terms
Basic Programming Resources
Partization in Java
Java basic grammar
java programming basics
Concurrency Method in Java with basic example
Rock-paper-scissors in Java
Java basic knowledge 1
[Java] Basic structure
[Java] [Basic] Glossary
java Generic Programming
Java basic grammar
Java basic grammar
Pi in Java
Java exercises [Basic]
FizzBuzz in Java
Implemented basic search / sort algorithm in Java
The story of learning Java in the first programming
Programming with direct sum types in Java (Neta)
[java] sort in list
Read JSON in Java
Interpreter implementation in Java
Make Blackjack in Java
Rock-paper-scissors app in Java
Put java8 in centos7
NVL-ish guy in Java
Combine arrays in Java
"Hello World" in Java
Callable Interface in Java
java basic knowledge memo
[Java] Data type ①-Basic type
Azure functions in java
Simple htmlspecialchars in Java
Java basic date manipulation
Boyer-Moore implementation in Java
Java programming basics practice-array
Hello World in Java
Java basic naming conventions
webApi memorandum in java
Type determination in Java
Java programming (class method)
Ping commands in Java
Java learning memo (basic)
Various threads in java
Heapsort implementation (in java)
ASCII art in Java
Compare Lists in Java
POST JSON in Java
Express failure in Java
Create JSON in Java
Date manipulation in Java 8
What's new in Java 8
Java programming (class structure)
All about Java programming
java competitive programming memo
Use PreparedStatement in Java