Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Main.java
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; public class Student { static int studentid, departmentID; static String name, gender, phone; } public class Hosteller extends Student { static String hostelname ,Yes, No, rn, pn; static int roomnumber; static Scanner s=new Scanner (System.in); public static void getHosteller () { System.out.println("student id"); studentid=s.nextInt(); System.out .println("student name "); name=s.next(); System.out.println("department id") ; departmentID=s.nextInt() ; System.out.println(" gender "); gender=s.next(); System.out.println(" phone number "); phone=s.next(); System. out. println("hostel name") ; hostelname=s.next() ; System.out.println(" roomnumber "); roomnumber=s.nextInt(); System.out.println(" Modify room number (Yes/No)"); rn=s.next(); if(Yes.equals(rn)) { System.out.println("new roomnumber ") ; rn=s.next() ; } System.out.println(" Modify phone number ") ; pn= s. next() ; if(Yes.equals(pn)) { System.out.println(" New phone number ") ; pn=s.next() ; } } } class Main { public static void main (String args[]) { Hosteller h=new Hosteller () ; System.out.println(" Enter the details ") ; h. getHosteller() ; } }
run
|
edit
|
history
|
help
0
1a
Ways to form Max Heap
boundary vs core
Problem Name: single_digit
Java - Swap two numbers without using temp var
Account JAVA Cpa
first activity
Find if a String2 is substring of String1
cosmology
victory1