Click here to Skip to main content
15,914,162 members
Home / Discussions / Java
   

Java

 
QuestionHow to interact with MS Outlook Exchange in Java? Pin
pcphuc27-Oct-10 16:31
pcphuc27-Oct-10 16:31 
AnswerRe: How to interact with MS Outlook Exchange in Java? Pin
Richard MacCutchan27-Oct-10 23:02
mveRichard MacCutchan27-Oct-10 23:02 
GeneralRe: How to interact with MS Outlook Exchange in Java? Pin
pcphuc27-Oct-10 23:15
pcphuc27-Oct-10 23:15 
GeneralRe: How to interact with MS Outlook Exchange in Java? Pin
Richard MacCutchan28-Oct-10 0:01
mveRichard MacCutchan28-Oct-10 0:01 
GeneralRe: How to interact with MS Outlook Exchange in Java? Pin
pcphuc28-Oct-10 0:09
pcphuc28-Oct-10 0:09 
GeneralRe: How to interact with MS Outlook Exchange in Java? Pin
Richard MacCutchan28-Oct-10 1:26
mveRichard MacCutchan28-Oct-10 1:26 
GeneralRe: How to interact with MS Outlook Exchange in Java? Pin
pcphuc28-Oct-10 16:32
pcphuc28-Oct-10 16:32 
QuestionUse of Assert Pin
vidhyaej27-Oct-10 2:03
vidhyaej27-Oct-10 2:03 
hi friends...

i was trying to do a sample program got from java tutorials ,where i encountered some errors with the use of assert keyword....can anyone help me to solve the problem..i am doing the program in eclipse...

Below given is my code...

public class Card {
    private final int rank;
    private final int suit;

    // Kinds of suits
    public final static int DIAMONDS = 1;
    public final static int CLUBS    = 2;
    
    // Kinds of ranks
    public final static int ACE   = 1;
    public final static int DEUCE = 2;
     
    public Card(int rank, int suit) {
        assert isValidRank(rank);
        assert isValidSuit(suit);
        this.rank = rank;
        this.suit = suit;
    }

    public int getSuit() {
        return suit;
    }

    public int getRank() {
        return rank;
    }

    public static boolean isValidRank(int rank) {
        return ACE <= rank && rank <= KING;
    }

    public static boolean isValidSuit(int suit) {
        return DIAMONDS <= suit && suit <= SPADES;
    }

    public static String rankToString(int rank) {
        switch (rank) {
        case ACE:
            return "Ace";
        case DEUCE:
            return "Deuce";
                default:
                return null;
        }    
    }
    
    public static String suitToString(int suit) {
        switch (suit) {
        case DIAMONDS:
            return "Diamonds";
        case CLUBS:
            return "Clubs";
                default:
            return null;
        }    
    }

    public static void main(String[] args) {
    	    	// use assert statements
        assert rankToString(ACE) == "Ace";
        assert rankToString(DEUCE) == "Deuce";
        
    }
}

AnswerRe: Use of Assert Pin
Nagy Vilmos27-Oct-10 2:37
professionalNagy Vilmos27-Oct-10 2:37 
GeneralRe: Use of Assert Pin
vidhyaej27-Oct-10 19:53
vidhyaej27-Oct-10 19:53 
GeneralRe: Use of Assert Pin
Gerben Jongerius27-Oct-10 20:34
Gerben Jongerius27-Oct-10 20:34 
GeneralRe: Use of Assert Pin
Peter_in_278027-Oct-10 21:07
professionalPeter_in_278027-Oct-10 21:07 
AnswerRe: Use of Assert Pin
naief1-Dec-10 8:18
naief1-Dec-10 8:18 
Questionmathematical symbol Pin
pipu12326-Oct-10 22:58
pipu12326-Oct-10 22:58 
AnswerRe: mathematical symbol Pin
Richard MacCutchan27-Oct-10 2:55
mveRichard MacCutchan27-Oct-10 2:55 
GeneralRe: mathematical symbol Pin
pipu12327-Oct-10 4:53
pipu12327-Oct-10 4:53 
GeneralRe: mathematical symbol Pin
Richard MacCutchan27-Oct-10 5:27
mveRichard MacCutchan27-Oct-10 5:27 
GeneralRe: mathematical symbol Pin
David Skelly27-Oct-10 22:32
David Skelly27-Oct-10 22:32 
QuestionJava Interface Componants Pin
kanishka_300026-Oct-10 19:36
kanishka_300026-Oct-10 19:36 
AnswerRe: Java Interface Componants Pin
Richard MacCutchan26-Oct-10 22:13
mveRichard MacCutchan26-Oct-10 22:13 
GeneralRe: Java Interface Componants Pin
kanishka_300027-Oct-10 2:30
kanishka_300027-Oct-10 2:30 
GeneralRe: Java Interface Componants Pin
Richard MacCutchan27-Oct-10 2:37
mveRichard MacCutchan27-Oct-10 2:37 
Questioncoding for implementing antivirus software [modified] Pin
kulbhushan125-Oct-10 1:16
kulbhushan125-Oct-10 1:16 
AnswerRe: coding for implementing antivirus software Pin
Cedric Moonen25-Oct-10 1:37
Cedric Moonen25-Oct-10 1:37 
QuestionPassing Parameters in Methods Pin
vidhyaej25-Oct-10 0:25
vidhyaej25-Oct-10 0:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.