-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNamingConvention.java
37 lines (28 loc) · 1.04 KB
/
NamingConvention.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class A {
public A() {
System.out.println("object created");
}
public void show() {
System.out.println("in A show");
}
}
public class NamingConvention {
// java uses Camel casing, first word is Capital
// for vars and methods - small letters will be used
// constants - all capital, PIE, BRAND
public static void main(String args[]) {
// python follow snake casing that is they use underscore, my_method()
// but in java we do camel case like this myMethod()
// ANONYMOUS OBJECTS -
// A obj = new A(); // obj is a refrence variables , because it is reffering to
// a object
// obj.show();
// int marks; // creating refrence
// marks = 99; // assigning value
// here is object creation
// new A(); // creates an object, but how do we use it , it is called anonymous
// object, they don't have a name.
new A().show(); // here is how we call it
new A().show();
}
}