Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Java String Array output error

$
0
0
import java.util.*;
import java.lang.*;
class Employees
{
    public void AddStaff()
        { 
            for(int i=0;i<4;i++)
            {
                String s[]={new Scanner(System.in).next()};
            }

            for(int i=0;i<4;i++)
            {
                System.out.println("The Staff is:"+s[i]);
            }
        }
}
class TestEmployee
{
    public static void main(String...arg)
        {
            Employees e=new Employees();
            e.AddStaff();
        }
}

//The question is i cannot get the String output on my screen it shows the error that Symbol s is not found/defined. please help me with a solution//

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>