java iso_java里boolean Isok=false/Isok=false;/while(Isok);分别都各是什么意思阿?;

importjava.util.Scanner;publicclassxia{publicstaticvoidmain(String[]args){Scannerinput=newScanner(System.in);System.out.println("\n\n\t\t\t欢迎使用我行我素购物管理系统\n"...

import java.util.Scanner;

public class xia{

public static void main(String[] args){

Scanner input=new Scanner (System.in);

System.out.println("\n\n\t\t\t欢迎使用我行我素购物管理系统\n");

System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n");

System.out.println("\t\t1.客\t他\t户\t信\t息\t管\t理\n");

System.out.println("\t\t2.购\t物\t管\t理\n");

System.out.println("\t\t3.真\t情\t回\t馈\n");

System.out.println("\t\t4.注\t销\n");

System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n");

System.out.println("\n请选择,输入数字:");

boolean Isok=false;

do{

int num=input.nextInt();

System.out.println("请输入正确的数字");

switch(num){

case 1:

System.out.println("客户信息管理");

Isok=false;

break;

case 2:

System.out.println("购物结算");

Isok=false;

break;

case 3:

System.out.println("真情回馈");

Isok=false;

break;

case 4:

System.out.println("注销");

Isok=false;

break;

default:

Isok=true;

break;

}

}while(Isok);

System.out.println("程序结束");

}

}

我在线等待答案.

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
代码应如何修改避免空指针异常package frame; import dao.ProductDAO; import dao.ProductDAOImpl; import model.Product; import javax.swing.; import java.awt.; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.SQLException; public class UpdateProductDialog extends JDialog { private boolean isOK = false; private Product product; private JTextField nameField; private JTextField priceField; private JTextArea descriptionArea; public UpdateProductDialog(Frame owner, int productId) { super(owner, "更新商品", true); setPreferredSize(new Dimension(400, 300)); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ProductDAO productDAO = new ProductDAOImpl() { @Override public Product getProductById(int id) { return null; } }; product = productDAO.getProductById(productId); JLabel nameLabel = new JLabel("名称"); JLabel priceLabel = new JLabel("价格"); JLabel descriptionLabel = new JLabel("描述"); nameField = new JTextField(product.getName()); priceField = new JTextField(Double.toString(product.getPrice())); descriptionArea = new JTextArea(product.getDescription(), 5, 20); JButton okButton = new JButton("确定"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String name = nameField.getText(); double price = Double.parseDouble(priceField.getText()); String description = descriptionArea.getText(); product.setName(name); product.setPrice(price); product.setDescription(description); isOK = true; dispose(); } }); JButton cancelButton = new JButton("取消"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); JPanel panel = new JPanel(new GridLayout(4, 2)); panel.add(nameLabel); panel.add(nameField); panel.add(priceLabel); panel.add(priceField); panel.add(descriptionLabel); panel.add(new JScrollPane(descriptionArea)); panel.add(okButton); panel.add(cancelButton); setContentPane(panel); pack(); setLocationRelativeTo(owner); } public boolean isOK() { return isOK; } public Product getProduct() { return product; } }
最新发布
06-12

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值