(3) Write a program to store 5 of your friend’s names in an array.
1
Expert's answer
2011-08-07T07:19:21-0400
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"); } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment