• Home
  • About
    • IT Nursery
    • Price Plan Style
    • Testimonials Style
    • FAQ’s
  • Portfolio Filter
  • Services
    • All Services
    • Business Consulting
    • Finance Report
    • Assets Mangement
    • Smart Manufacturing
    • Life Insurance
    • Tax & Order Making
  • News
  • Contact
IT Nursery

Expert WordPress Theme Developer. Can developing websites by using Elementor, divi and Visual Composer. Provide 100% guarantee on the quality and reliability of the code.

  • (+880) 1676299226
  • info@itnursery.com
  • Office Hour: 8AM - 11PM
    • About
    • About Us
    • Assets Mangement
    • Business Consulting
    • Call To Action Style
    • Contact
    • Counter Style
    • FAQ’s
    • Finance Report
    • Heading Style
    • Home
    • Home Five
    • Home Four
    • Home Seven
    • Home Six
    • Home Three
    • Home Two
    • Life Insurance
    • News
    • Portfolio Filter
    • Portfolio Grid Style
    • Portfolio Grid Style 1
    • Portfolio Grid Style 2
    • Portfolio Slider Style
    • Price Plan Style
    • Privacy Policy
    • Sample Page
    • Services
    • Services Style
    • Smart Manufacturing
    • Tax & Order Making
    • Team Filter Style
    • Team Grid Style
    • Testimonials Style
  • info@itnursery.com
  • (880) 1676299226
IT Nursery
IT Nursery
  • 1010 Avenue of the Moon
    New York, NY 10018 US.
  • Mon - Sat 8.00 - 18.00
    Sunday: Closed
  • Get A Quote
IT Nursery
  • Home
  • About
    • IT Nursery
    • Price Plan Style
    • Testimonials Style
    • FAQ’s
  • Portfolio Filter
  • Services
    • All Services
    • Business Consulting
    • Finance Report
    • Assets Mangement
    • Smart Manufacturing
    • Life Insurance
    • Tax & Order Making
  • News
  • Contact
  • Java
  • How to write a test class to test my code?

    • IT Nursery
    • April 3, 2022
    • 0

    4

    I want a test class to test this class but i dont know how to write it and i tried to see online but i still couldnt figure it out.I wrote the code on BlueJ, i’m trying to create the set game.

    import java.util.*;
    
    public class Deck
    {
        ArrayList<Card> deck;
        public Deck ()
        {
             deck = new ArrayList<Card>();
        }
    
         public Deck (int capacity)
        {
            deck = new ArrayList<Card>(capacity);
        }
    
        public int getNumCards ()
        {
            return deck.size();
        }
    
        public boolean isEmpty () 
        {
            return deck.isEmpty();
        }
    
        public void add (Card card) 
        {
            deck.add(0,card);
        }
    
        public Card takeTop() 
        {
            return deck.remove(0);
        }
    
        public void shuffle ()
        {
            Collections.shuffle(deck);
        }
    
        public void sort ()
        {
            Collections.sort(deck);
        }
    
        public String toString ()
        { 
             return (deck.toString()+ "\n");
        }
    }
    
    
    Tags: arraylistbluejjava
    • Previous Java Main Game Loop
    • Next How can you access the contents of Android Emulator databases?

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    IT Nursery

    About IT Nursery

    Expert WordPress Theme Developer. Can developing websites by using Elementor, divi and Visual Composer. Provide 100% guarantee on the quality and reliability of the code.

    Our Services

    • Business Consulting
    • Finance Report
    • Life Insurance
    • Tax & Order Making
    • Assets Mangement

    Get In Touch

    • (+880) 1676299226
    • info@itnursery.com
    • Office Hour: 8AM - 11PM

    Subscribe Now

      IT Nursery - 2025