Please Help

I'm stuck on a problem and need help. I'm supposed to write a program that calculates the points for a Bridge game. After placing the cards into arrays made for each suit, the program would check to see if the card was a Jack, Queen, King, or Ace and add points accordingly. The program is, even if the requirements were met to add the points, the program would completely ignore it. I determine the point value 1 suit at a time, one method per suit. Thank you for your time.

Here is my code:

import java.util.Scanner;

publicclass Bridge

{

String diamonds[];

String clubs[];

String hearts[];

String spades[];

int diamondsIncrement= 0;

int clubsIncrement = 0;

int heartsIncrement = 0;

int spadesIncrement = 0;

int points = 0;

publicvoid cardInput()

{

Scanner input =new Scanner (System.in);

diamonds =new String[13];

clubs =new String[13];

hearts =new String[13];

spades =new String[13];

String hand;

System.out.println("Enter hand seperated by spaces:");

hand = input.nextLine();

for(int i = 0; i < 38; i++)

{

if (hand.charAt(i) =='D')

{

diamonds[diamondsIncrement] = ("" + hand.charAt(i-1));

diamondsIncrement+= 1;

}

if (hand.charAt(i) =='C')

{

clubs[clubsIncrement] = ("" + hand.charAt(i-1));

clubsIncrement++;

}

if (hand.charAt(i) =='H')

{

hearts[heartsIncrement] = ("" + hand.charAt(i-1));

heartsIncrement++;

}

if (hand.charAt(i) =='S')

{

spades[spadesIncrement] = ("" + hand.charAt(i-1));

spadesIncrement++;

}

}

}

publicvoid determineDiamondsValue()

{

if (diamondsIncrement == 0)

points = points + 3;

if (diamondsIncrement == 1)

points = points + 2;

if (diamondsIncrement == 2)

points = points + 1;

if (diamondsIncrement >= 5)

points = (diamondsIncrement - 5) + points;

for (int i = 0; i < 13; i++)

{

if (diamonds[i] =="A")

points = points + 4;

if (diamonds[i] =="K")

points = points + 3;

if (diamonds[i] =="Q")

points = points + 2;

if (diamonds[i] =="J")

points = points + 1;

if (diamonds[i] ==null)

i = 13;

}

System.out.println(points);

}

publicvoid determineClubsValue()

{

if (clubsIncrement == 0)

points = points + 3;

if (clubsIncrement == 1)

points = points + 2;

if (clubsIncrement == 2)

points = points + 1;

if (clubsIncrement >= 5)

points = (clubsIncrement - 5) + points;

for (int i = 0; i < clubs.length; i++)

{

if (clubs[i] =="A")

points += 4;

if (clubs[i] =="K")

points = points + 3;

if (clubs[i] =="Q")

points = points + 2;

if (clubs[i] =="J")

points = points + 1;

if (clubs[i] ==null)

i = 13;

}

System.out.println(points);

}

publicvoid determineHeartsValue()

{

if (heartsIncrement == 0)

points = points + 3;

if (heartsIncrement == 1)

points = points + 2;

if (heartsIncrement == 2)

points = points + 1;

if (heartsIncrement >= 5)

points = (heartsIncrement - 5) + points;

for (int i = 0; i < 13; i++)

{

if (hearts[i] =="A")

points = points + 4;

if (hearts[i] =="K")

points = points + 3;

if (hearts[i] =="Q")

points = points + 2;

if (hearts[i] =="J")

points = points + 1;

if (hearts[i] ==null)

i = 13;

}

System.out.println(points);

}

publicvoid determineSpadesValue()

{

if (spadesIncrement == 0)

points = points + 3;

if (spadesIncrement == 1)

points = points + 2;

if (spadesIncrement == 2)

points = points + 1;

if (spadesIncrement >= 5)

points = (spadesIncrement - 5) + points;

for (int i = 0; i < spades.length; i++)

{

if (spades[i] =="A")

points = points + 4;

if (spades[i] =="K")

points = points + 3;

if (spades[i] =="Q")

points = points + 2;

if (spades[i] =="J")

points = points + 1;

if (spades[i] ==null)

i = 13;

}

printScore();

}

publicvoid printScore()

{

System.out.print("Diamonds:");

for (int i = 0; i < 13; i++)

{

if (diamonds[i] =="T")

System.out.print("10 ");

if (diamonds[i] !=null)

System.out.printf("%s ", diamonds[i]);

}

System.out.println("");

System.out.print("Clubs:\t");

for (int i = 0; i < 13; i++)

{

if (clubs[i] =="T")

System.out.print("10 ");

if (clubs[i]!=null)

System.out.printf("%s ",clubs[i]);

}

System.out.println("");

System.out.print("Hearts:\t");

for (int i = 0; i < 13; i++)

{

if (hearts[i] =="T")

System.out.print("10 ");

if (hearts[i]!=null)

System.out.printf("%s ",hearts[i]);

}

System.out.println("");

System.out.print("Spades:\t");

for (int i = 0; i < 13; i++)

{

if (spades[i] =="T")

System.out.print("10 ");

if (spades[i]!=null)

System.out.printf("%s ",spades[i]);

}

System.out.println("");

}

}

[10944 byte] By [FaLLeNAn9eLa] at [2007-11-26 20:52:20]
# 1
You are comparing Strings for equality using ==, you should be using the equals method.
YoGeea at 2007-7-10 2:17:42 > top of Java-index,Java Essentials,New To Java...
# 2
Thank you so much! It fixed the problem.I'm getting a error that looks like this now:Exception in thread "main" java.lang.NullPointerExceptionat Bridge.determineDiamondsValue(Bridge.java:80)at BridgeTest.main(BridgeTest.java:8)
FaLLeNAn9eLa at 2007-7-10 2:17:42 > top of Java-index,Java Essentials,New To Java...
# 3
Go to line 80 of your Bridge class, you are doing something like calling the instance method of a null object, accessing or modifying the field of a null object, etc.
YoGeea at 2007-7-10 2:17:42 > top of Java-index,Java Essentials,New To Java...
# 4
Thank you so much for your help!
FaLLeNAn9eLa at 2007-7-10 2:17:42 > top of Java-index,Java Essentials,New To Java...