Answers for "java object class"


classes in java

public class Main {
  int x = 5;

  public static void main(String[] args) {
    Main myObj = new Main();
Posted by: Guest on September-25-2021

java object class

class Student{  
 //defining fields  
 int id;//field or data member or instance variable  
 String name;  
 //creating main method inside the Student class  
 public static void main(String args[]){  
  //Creating an object or instance  
  Student s1=new Student();//creating an object of Student  
  //Printing values of the object  
  System.out.println(;//accessing member through reference variable  
Posted by: Guest on November-17-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language