I am a high school student currently taking an introductory computer science course. In class we were assigned with creating a program that would take user input for card notation and return the full description of the card. For example, A user who inputs "AS" would see "Ace of Spades" in the terminal window. However, when my code executes, I get a "null of null" instead of "Ace of Spades" or another card notation.
public class Card
{
private String rank; 
private String suit;
private String fullRank;
private String fullSuit;
public Card(String rankAndSuit)
{
    rank = rankAndSuit.substring(0,1);
    if (rank == "A")
    {    
       fullRank = "Ace";
    } 
    else
    if  (rank == "2")
    {
        fullRank = "2"; 
    }
    else
    if (rank == "3")
    {    
        fullRank = "3";
    } 
    else
    if  (rank == "4")
    { 
        fullRank = "4"; 
    }
    else
    if (rank == "5")
    {    
        fullRank = "5";
    } 
    else
    if  (rank == "6")
    { 
        fullRank = "6"; 
    }
    else
    if (rank == "7")
    {    
        fullRank = "7";
    } 
    else
    if  (rank == "8")
    {
        fullRank = "8"; 
    }
    else
    if (rank == "9")
    {    
        fullRank = "9";
    } 
    else
    if  (rank == "10")
    {
        fullRank = "10"; 
    }
    else
    if (rank == "J")
    {    
        fullRank = "Jack";
    } 
    else
    if  (rank == "Q")
    { 
        fullRank = "Queen"; 
    }
    else
    if (rank == "K")
    {    
        fullRank = "King";
    } 
    suit = rankAndSuit.substring(1,2);
    if (suit == "D")
    {    
       fullSuit = "Diamonds";
    } 
    else
    if  (suit == "H")
    {
        fullSuit = "Hearts"; 
    }
    else
    if (suit == "S")
    {    
        fullSuit = "Spades";
    } 
    else
    if  (suit == "C")
    {      fullSuit = "Clubs"; 
    }
}
public String getCardDescription()
{
    return fullRank + " of " + fullSuit;
}
}
My Tester Class is :
public class CardTester
{
public static void main(String[] args)
{
    Card testCard = new Card("AS");
    String cardDescription = testCard.getCardDescription();
    System.out.print(cardDescription);
}
}
What is causing me to get null?
 
     
     
    