是什么导致我的奖品类错误?

时间:2018-10-25 08:27:20

标签: java abstract

我的代码:

body { /* General Body Properties */
    font-family: Trebuchet MS, Georgia, Helvetica, sans-serif;
    margin: 0;
    overflow: hidden;
}

* { /* Key element to aligning <divs> (DO NOT REMOVE) */
    box-sizing: border-box;
}

.header { /* Header properties featuring myEd and school emblems */
    padding: 30px;
    text-align: center; /* Aligns links in the navBar */
    background-image: url(/Home/Welcome/Img/backgroundHeader-4K.jpg);
    background-size: cover;
    background-repeat: no-repeat;
}

.myEd-reverse {
    width: 240px;
    height: 70px;
    float: left;
    margin-left: -60px;
    margin-top: -40px;
}

.navBar { /* Sticky navBar, either relative or fixed, depending on the scroll position of the site */
    overflow: hidden;
    background-color: #333;
    position: sticky;
    position: -webkit-sticky;
    top: 0;
}

.navBar a { /* Style the navBar links */
    float: left;
    display: block;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    text-decoration: none;
}

.navBar a.right { /* Float Quick Links, Help and Log-out navBar directory items to the right of the navBar */
    float: right;
}

.navBar a:hover { /* Change color on hover */
    background-color: #ddd;
    color: #000;
}

.navBar a.active { /* Active Link */
    background-color: #666;
    color: #fff;
}

.row { /* Alignment between sideBar and main */
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.sideBar { /* sideBar alignment properties */
    -ms-flex: 20%;
    flex: 20%;
    background-color: #a7a7a7;
    padding: 0px;
    height: 5000px; /* As standard to work on all screen resolutions, overflow hides excess */
    overflow-y: scroll;
}

.profilePanel { /* Panel properties */
    background-color: #585858;
    width: 100%;
    padding: 0px;
}

#newsmyEd {
    width: 100%;
    height: 100%;
}

.main { /* Main Column */
    -ms-flex: 80%;
    flex: 80%;
    background-color: #a7a7a7;
    padding: 0px;
    height: 5000px; /* As standard to work on all screen resolutions, overflow hides excess */
    overflow-y: scroll;
}

.frameMain { /* Frame Properties */
    position: relative;
    left: 0;
    width: 100%;
    min-height: 6000px;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background-color: #333;
}

@media screen and (max-width: 700px) { /* Responsive Layout - If screen px is less than 700px, make sideBar and main stack on top of each other */
    .row {   
        flex-direction: column;
    }
}

@media screen and (max-width: 400px) { /* Responsive Layout - If screen px is less than 400px, make navBar links stack vertically on top of each other */
    .navBar a {
        float: none;
        width: 100%;
    }
}

什么导致我的代码出现问题?我不确定自己在做什么错。

3 个答案:

答案 0 :(得分:0)

不要在代码中使用(“”)。

public void print() {
    System.out.println(“Contestant “ + recipient + “has won a “ + itemName);
    System.out.println(“A total of “ + prizeCount + “prizes have been given away!!!”);
}

答案 1 :(得分:0)

除了错误的双引号外,您不能使用类名调用实例方法。

这行不通。

SELECT
  albums.title AS Album,
  artists.name AS Artist,
  COUNT(*) as TitleCount
FROM tracks
INNER JOIN albums ON albums.albumid = tracks.albumid
INNER JOIN artists ON artists.artistid = albums.artistid
GROUP BY albums.albumid 
HAVING COUNT(*) IN
(
  SELECT DISTINCT COUNT(*)
  FROM tracks
  GROUP BY albumid
  ORDER BY count(*) DESC
  LIMIT 5
)
ORDER BY TitleCount DESC;

您需要在奖赏类的实例上调用打印方法。像这样

Prize.print();

或将方法设为静态,然后可以使用类名进行调用。

答案 2 :(得分:0)

您需要使print()方法为静态方法,或者在两个实例化对象上调用它。即p1.print() or p2.print()