63 831
Assignments Done
99,2%
Successfully Done
In August 2018

Answer to Question #3480 in Java | JSP | JSF for Y mukundareddy

Question #3480
(3) Write a program to store 5 of your friend’s names in an array.
Expert's answer
import java.io.*;

public class Task10
{
public static void main(String[] args) throws IOException
{
& // Preparing the stream
& BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in));

& // reading the names of the friends
& String[] friendNames = new String[5];
& System.out.println("Enter the names of 5 your friends");
& for (int i = 0; i < 5; i++)
& {
& System.out.print("Enter the name of friend " + (i + 1) + ": ");
& friendNames[i] = bReader.readLine();
& }

& // All names are stored in array
& System.out.print("\nNow the array 'friendNames' stores 5 of your friend’s names");
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions