Java Announce Now, Define Later

In java, can you declare a method in a class and then either define it later in the class or outside the class?

I am looking for something similar to C ++ where you declare it, then use the format :: outside the class to define it later?

In addition, without overloading the method.

+3
source share
2 answers

C ++ member functions are never defined "outside the class". The prefix Class_Name::places them inside the class. They simply are not included in the class declaration.

++, . , . Java , .

, , , (, Pascal , ), Java , . . , , , . ( , 1968 .)

, , ? , . ( " ".)

, , . , ++, - . class myclass { public: myclass(); }; myclass::myclass() { /* constructor */ }. myclass , , , , .

+5

Java. , , . , .

+2

All Articles