write a program of student using a classobjects


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

 

  • Though you can also use

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.

 

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: write a program of student using a classobjects
Reference No:- TGS0356463

Expected delivery within 24 Hours