/*manimbo_mp5*/
import java.io.*;
	public class manimbo_mp5{
		public static void main (String[]args) throws IOException{
			BufferedReader br=new BufferedReader (new InputStreamReader (System.in));
			Integer x=8,y=1,heads=0,tails=0;
			String ht="";
			while (x>0){
				System.out.print ("Enter toss #" + y + " result: ");
				ht=br.readLine();
				if (ht=="h"){
					heads++;
				}
				else if (ht=="t"){
					tails++;
				}
				x--;
				y++;
				System.out.println ("Tails: " + tails);
				System.out.println ("Heads: " + heads);
				System.out.println ("ht is " + ht);
			}
		}
	}

I can't get output for "tails" and "heads"...

Use the equals method to compare Strings:

if ( ht.equals("h") ) {

}

Also you don't need to declare your integers Integer. Simple int will suffice:

int x=8,y=1,heads=0,tails=0;

thanks a lot javaAddict!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.