SHARE
TWEET

oop

a guest Sep 20th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package oopbasic;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class MainClass {
  6.     public static void main( String args[]) {
  7.         Student[] students=new Student[4];
  8.         Scanner sc= new Scanner(System.in);
  9.         for(int i=0;i<students.length;i++) {
  10.        
  11.             students[i]=new Student();
  12.            
  13.             System.out.println("Enter name:");
  14.             students[i].name=sc.nextLine();
  15.            
  16.             System.out.println("Enter phone:");
  17.             students[i].phone=sc.next();
  18.            
  19.             System.out.println("Enter seid:");
  20.             students[i].seid=sc.nextInt();
  21.            
  22.             System.out.println();
  23.             System.out.println("------------");
  24.            
  25.         }
  26.     }
  27. }
  28.  
  29.  
  30.  
  31. ---------------------------
  32.  
  33.  
  34. package oopbasic;
  35.  
  36. public class Student {
  37.     public String name;
  38.     public int seid;
  39.     public String phone;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top