Specifications
Sun Services
Java™ Programming Language
Module 7, slide 26 of 44
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Static Imports
An example of a static import is:
0
1 package cards.tests;
2
3 import cards.domain.PlayingCard;
4 import static cards.domain.Suit.*;
5
6 public class TestPlayingCard {
7 public static void main(String[] args) {
8
9 PlayingCard card1 = new PlayingCard(SPADES, 2);
10 System.out.println(“card1 is the “ + card1.getRank()
11 + “ of “ + card1.getSuit().getName());
12
13 // NewPlayingCard card2 = new NewPlayingCard(47, 2);
14 // This will not compile.
15 }
16 }










