Computer Science, asked by drishtipandey05, 3 months ago

Write a program IN JAVA to declare a class student with integer data type for roll no. string for name and standard and character for section. The class must have functions for input (assign values), print and the main function to create an object and to call the functions

Answers

Answered by hello1320
0

// not public because I didn't make it as a main class of the program if u want then make it public

class Student{

int roll_no;

String name , standard;

char section;

//make getters and setters for all of them

}

// itne points mein itna hi milenga

Answered by aditoburrito2046
0

Answer:

public class student

{

  int r=0;

  String s="";

  String n="";

  char ch=' ';

  public void input()

  {

     r=2;

     n= burrito;

     s=10;

     ch= E;

   }

  public void print()

  {

       System.out.println("Name = "+n+"\nRoll no. = "+r+"\nStandard = "+s+"\nsection = "+ch);

   }

   public static void main()

   {

       

       student obj = new student();

       obj.input();

       obj.print();

   }

}

Explanation:

Similar questions