标题:头大了
只看楼主
神经塔
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1986
专家分:4
注 册:2006-7-1
结帖率:0
 问题点数:0 回复次数:3 
头大了

package zuoye;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author lss
* @version 1.0
*/
abstract class Drink{
Drink() {
}

abstract void taste();

public static final int Coffee = 1;
public static final int Beer = 2;
public static final int Milk = 3;

public static Drink getDrink(int driinkType) {
switch (driinkType) {
case 1:
System.out.println("咖啡:");
case 2:
System.out.println("啤酒:");

case 3:
System.out.println("牛奶:");
}
}

class Coffee extends Drink {
Coffee() {
}
void taste() {
System.out.println("苦味");
}
}
class Beer extends Drink {
Beer() {
}
void taste() {
System.out.println("辛辣");
}
}


class Milk extends Drink {
Milk() {
}

void taste() {
System.out.println("甜味");
}
}
public class Test {
public Test() {
}

public static void main(String[] args) {
try {
Drink.getDrink(Integer.parseInt(args[0]));
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
}
问什么有错????快来救我啊~

[此贴子已经被作者于2006-9-22 23:19:52编辑过]

搜索更多相关主题的帖子: int public Drink static final 
2006-09-22 23:17
hellboy
Rank: 1
等 级:新手上路
威 望:1
帖 子:245
专家分:0
注 册:2006-6-24
得分:0 
以下是引用神经塔在2006-9-22 23:17:30的发言:

package zuoye;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author lss
* @version 1.0
*/
abstract class Drink{
Drink() {
}

abstract void taste();

public static final int Coffee = 1;
public static final int Beer = 2;
public static final int Milk = 3;

public static Drink getDrink(int driinkType) {
switch (driinkType) {
case 1:
System.out.println("咖啡:");
case 2:
System.out.println("啤酒:");

case 3:
System.out.println("牛奶:");
}
}//函数没有返回

class Coffee extends Drink {
Coffee() {
}
void taste() {
System.out.println("苦味");
}
}
class Beer extends Drink {
Beer() {
}
void taste() {
System.out.println("辛辣");
}
}


class Milk extends Drink {
Milk() {
}

void taste() {
System.out.println("甜味");
}
}
public class Test {
public Test() {
}

public static void main(String[] args) {
try {
Drink.getDrink(Integer.parseInt(args[0]));
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
}
问什么有错????快来救我啊~

//整体括号也是不匹配的 该该就好了



努力 努力 !!!!!!
2006-09-22 23:26
爱疯了
Rank: 1
等 级:新手上路
帖 子:38
专家分:0
注 册:2006-9-5
得分:0 
这样就对了吗
2006-09-23 16:31
hellboy
Rank: 1
等 级:新手上路
威 望:1
帖 子:245
专家分:0
注 册:2006-6-24
得分:0 

应该差不多吧


努力 努力 !!!!!!
2006-09-23 18:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-92271-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.133163 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved