Write a program of student Using a Class
Objects of a class are always created on heap using "new" operator followed by constructor
- Student s = new Student ( ); // no pointer operator "*" between Student and s
- Only String constant is an exception
String greet = "Hello" ; // No new operator
String greet2 = new String("Hello");
Members of a class ( member variables and methods also called as instance variables/methods ) are accessed using "." operator. There is no "Æ" operator in java
s.setName("Ali");
sÆsetName("Ali") is incorrect and won't compile in java
Note: Primitives are always passed by value and objects are always passed by reference and in java.