U
U
username52020-05-13 21:29:40
Java
username5, 2020-05-13 21:29:40

What is the difference between "call" and "call" a class member?

Good day.
I am learning Java and wondered: what is the difference between "call" and "access" a class member?

Context:
One course defines the following: A constructor in Java is a method that cannot be called, but can be called upon to initialize a class object when it is created.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Developer, 2020-05-13
@samodum

Call is usually for a method, function.
Refer - usually to properties, fields to get a value.
It is not necessary to attach great importance to this terminology, it is absolutely not important and is not necessary in real work.

S
Sergey, 2020-05-14
@sergyx

A constructor in Java is a method that cannot be called.

you cannot run a constructor by referring to it as a class method like this: MyClass.MyClass()
but which can be referred to to initialize the class object when it is created

but you can run it for execution by writing an object creation construct
myVar = new MyClass();

S
Sergey Vodakov, 2020-05-13
@WaterSmith

Apparently this is the result of a crooked translation. In this context, it means that the constructor code will be executed when an instance of the class is created, and it cannot be called otherwise.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question