Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to pass variable(s)?

$
0
0
private static void colReader(String s) throws IOException 
{
	 FileReader readhandle = new FileReader("C:\\****\\****");
	    BufferedReader br = new BufferedReader(readhandle);
	    String line = null;
	    while((line = br.readLine()) != null)
	    {
	      colProduce(line, 0); 
	    }

	    br.close();
	    readhandle.close();
}

private static void colScanner(String s)
{
	char letter = 0;
	
	String fullWord;
	Scanner kb = new Scanner(System.in);
	
	System.out.print("Enter your word ");
	
	fullWord = kb.nextLine();
	System.out.println(fullWord);
	colProduce(fullWord, letter);
}

private static void colProduce(String text, int j)
{
	
for (int i = 0; i < text.length(); i++)
{
	j = text.charAt(i);
	switch(Character.toUpperCase(j))
	{
		case 'A':
		{
		   Blue()
		}
		break;
        }
}
}



Hey guys, I'm trying to pass the variables line (from colRead method), and the fullWord variable (from colScanner method) to the colProduce method.

I'm kind of stuck because, in the code I've produced ONLY the colReader method works, when I attempt to run the colScanner method from my menu, nothing happens! It just refreshes back to the menu.

I've been stuck on this for a bit now and it's driving me crazy!

Any help please?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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