Sunday, August 12, 2012

Java program to read and print n student names


import java.io.*;
class stringop1
{
String s[];
int n;
stringop1(int x)
{
s= new String[x];
n=x;
}
void get()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<n;i++)
{
System.out.print("\nName of student "+(i+1)+" : ");
s[i]=br.readLine();
}
}
void disp()
{
System.out.print("\nThe Entered names are : ");
for(int i=0;i<n;i++)
System.out.print("\nName "+(i+1)+" : " +s[i]);
}
public static void main(String[] args)throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\nEnter the no.of students : ");
int x=Integer.parseInt(b.readLine());
stringop1 s=new stringop1(x);
s.get();
s.disp();
}
}

1 comment:

  1. Yoexch247 is an online betting platform that offers a diverse range of gambling options, including sports betting and casino games. It provides users with a user-friendly interface and a variety of betting markets to cater to different preferences. Yoexch247 emphasizes secure transactions and customer support to ensure a reliable betting environment. However, it's important to note that online gambling regulations vary by region, and users should verify the legality of such platforms in their jurisdiction before participating.

    ReplyDelete