Please enable JavaScript.
Coggle requires JavaScript to display documents.
Ordering Elements in a Class (Elements of a class (Not required (Package…
Ordering Elements in a Class
Elements of a class
Required
Class declaration
e.g public class C{}
immediately after the import
Not required
Package declaration
e.g package abc;
first line in file
Import statements
e.g import java.util.*;
immediately after the package
Field declaration
e.g int value;
anywhere inside a class
Method declaration
e.g void method()
anywhere inside a class
tips
PIC(picture)
Package
Import
Class
Order of declaration in a class
Classes
can have one more class in files
must have one public class in file
or none