Results 1 to 2 of 2
  1. #1
    sharadjain is offline Member
    Join Date
    Aug 2014
    Posts
    4
    Rep Power
    0

    Default store the name SD array and dispaly the room and floor no. whose name is entered

    I have to store the name SD array and dispaly the room and floor no. whose name is entered but i am having a problem with the logic part .the answer is coming to be wrong



    import java .io.*;
    class hotel
    {
    public static void main()throws IOException
    {
    InputStreamReader read = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(read);
    String ar[][] = new String[5][10];
    String s="";
    int i,j,k,l;
    for(i=0;i<5;i++)
    {
    for(j=0;j<10;j++)
    {
    System.out.println("enter the name");
    ar[i][j]=br.readLine();
    }}
    System.out.println("enter the name =");
    s=br.readLine();
    for(k=0;k<5;k++)
    {
    for(l=0;l<10;l++)
    {
    if(s==ar[k][l]);
    }
    System.out.println("floor ="+k+"room"+l);
    }}}

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: store the name SD array and dispaly the room and floor no. whose name is entered

    Please focus on http://www.java-forums.org/new-java/...s-entered.html first. Also, there is no single dimension
    array in the above code. And don't forget the code tags.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 6
    Last Post: 06-29-2012, 11:53 PM
  2. Dispaly data from mysql database into JSP.
    By kritijain in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-16-2011, 09:17 AM
  3. Replies: 4
    Last Post: 11-05-2010, 11:43 AM
  4. Replies: 1
    Last Post: 03-31-2009, 07:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •