Find the basics of Java
|
byte / short / int / long
|
-123, 10
|
|
float / double
|
235.13
|
|
char
|
'a', 'A', '$', '-'
|
|
boolean
|
true, false
|
|
String
|
'Alice', 'A234t'
|
|
How to define any method in a class?
A class method can be declared/defined using the syntax: public|private [static] <return_type> <method_name>([arguments])
|
|
How to call a static method?
Static methods are also called as class methods and they can be called directly without creating any instance.
|
|
How to call any instance method?
Instance or non-static method can only be called after instantiating the object. So first create an object from a class using <class_name> <obj_name> = new <class_name>() and then call the method with this object. Ex.
Scanner scanner = new Scanner(System.in);
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.