java代码大全求个JAVA输入输出完整代码

java代码大全  时间:2021-06-25  阅读:()

求一个简单的java代码

代码如下,每句都加了注释了,希望能帮到你.... import java.util.Scanner; public class Test { public static void main(String[] args) { String name;//保存姓名 int age;//保存年龄 Scanner in = new Scanner(System.in);//用于获取用户的输入 System.out.print("请输入您的姓名 :");//提示用户输入姓名 name = in.nextLine();//提取用户输入的姓名 System.out.print("请输入您的年龄 :");//提示用户输入年龄 age = in.nextInt();//提取用户输入的年龄 System.out.println("姓名 :" + name);//显示用户的姓名 System.out.println("年龄 : " + age);//显示用户的年龄 } }

java语言代码完整的代码

.shijie.test; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class test1 { static mproduct m1 = new mproduct(); static mproduct m2 = new mproduct(); static mproduct m3 = new mproduct(); public static void main(String[] args) { // 初始话数据 GetList(); System.out.println("***************"); System.out.println("请选择购买的商品编号"); System.out.println(m1.id + "." + m1.name + " " + m2.id + "." + m2.name + " " + m2.id + "." + m2.name + " "); System.out.println("***************"); System.out.println("请输入商品编号:"); Scanner s = new Scanner(System.in); int int1 = s.nextInt(); if (int1 == 1) { System.out.println(m1.name + " " + m1.price); } else if (int1 == 2) { System.out.println(m2.name + " " + m2.price); } else if (int1 == 3) { System.out.println(m3.name + " " + m3.price); } System.out.println("是否继续:"); while (new Scanner(System.in).next().equals("y")) { System.out.println("请输入商品编号:"); Scanner s2 = new Scanner(System.in); int int2 = s.nextInt(); if (int1 == 1) { System.out.println(m1.name + " " + m1.price); } else if (int2 == 2) { System.out.println(m2.name + " " + m2.price); } else if (int2 == 3) { System.out.println(m3.name + " " + m3.price); } System.out.println("是否继续:"); } } static class mproduct { int id; String name; double price; } static void GetList() { m1.id = 1; m1.name = "T血"; m1.price = 245.0; m2.id = 2; m2.name = "网球鞋"; m2.price = 570.0; m3.id = 1; m3.name = "网球拍"; m3.price = 247.0; } }

求一个java代码

运行过了,效果绝对让你满意!呵呵…… 说明: 要在E:目录下放置好“头像6.jpg”和“头像5.jpg”作为回答正确、回答错误时候要显示的图片。

(当然啦,你放在项目的根目录下都可以,只要稍微改一下那个路径就可以了) import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.Dimension; import javax.swing.JLabel; import java.awt.Rectangle; import javax.swing.JRadioButton; import javax.swing.ImageIcon; import javax.swing.*; public class EGshiti extends JFrame { private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JLabel jLabel = null; private JLabel jLabel1 = null; private JRadioButton jRadioButton = null; private JRadioButton jRadioButton1 = null; private JRadioButton jRadioButton2 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private ButtonGroup bg=null; /** * This is the default constructor */ public EGshiti() { super(); initialize(); } /** * This method initializes this * * @return void */ private void initialize() { this.setSize(336, 291); this.setContentPane(getJContentPane()); this.setTitle("英语试题"); this.setVisible(true); this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jLabel3 = new JLabel(); jLabel3.setBounds(new Rectangle(135, 67, 85, 74)); jLabel3.setText(""); jLabel2 = new JLabel(); jLabel2.setBounds(new Rectangle(20, 155, 256, 18)); jLabel1 = new JLabel(); jLabel1.setBounds(new Rectangle(15, 36, 155, 18)); jLabel1.setText("( ) some flowers for you"); jLabel = new JLabel(); jLabel.setBounds(new Rectangle(15, 14, 39, 18)); jLabel.setText("题目:"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(jLabel, null); jContentPane.add(jLabel1, null); jContentPane.add(getJRadioButton(), null); jContentPane.add(getJRadioButton1(), null); jContentPane.add(getJRadioButton2(), null); jContentPane.add(jLabel2, null); jContentPane.add(jLabel3, null); bg=new ButtonGroup(); bg.add(jRadioButton); bg.add(jRadioButton1); bg.add(jRadioButton2); } return jContentPane; } /** * This method initializes jRadioButton * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton() { if (jRadioButton == null) { jRadioButton = new JRadioButton(); jRadioButton.setBounds(new Rectangle(16, 60, 88, 26)); jRadioButton.setText("A.给你的花"); jRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel3.setIcon(new ImageIcon("E:\头像6.jpg")); jLabel2.setText("正确答案:A。

原因不用解释了吧~~呵呵……"); } }); } return jRadioButton; } /** * This method initializes jRadioButton1 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton1() { if (jRadioButton1 == null) { jRadioButton1 = new JRadioButton(); jRadioButton1.setBounds(new Rectangle(16, 90, 88, 26)); jRadioButton1.setText("B.给他的花"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel3.setIcon(new ImageIcon("E:\头像5.jpg")); jLabel2.setText("正确答案:A。

原因不用解释了吧~~呵呵……"); } }); } return jRadioButton1; } /** * This method initializes jRadioButton2 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton2() { if (jRadioButton2 == null) { jRadioButton2 = new JRadioButton(); jRadioButton2.setBounds(new Rectangle(16, 123, 88, 26)); jRadioButton2.setText("C.给她的花"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel3.setIcon(new ImageIcon("E:\头像5.jpg")); jLabel2.setText("正确答案:A。

原因不用解释了吧~~呵呵……"); } }); } return jRadioButton2; } public static void main(String args[]){ new EGshiti(); } } // @jve:decl-index=0:visual-constraint="10,10"

求个JAVA输入输出完整代码

//package ??; import java.util.Scanner; public class D{ public static void main(String args[]) { Scanner input = new Scanner(System.in); double d = input.nextDouble(); System.out.println(d); } }

Hosteons:新上1Gbps带宽KVM主机$21/年起,AMD Ryzen CPU+NVMe高性能主机$24/年起_韩国便宜服务器

我们在去年12月分享过Hosteons新上AMD Ryzen9 3900X CPU及DDR4内存、NVMe硬盘的高性能VPS产品的消息,目前商家再次发布了产品更新信息,暂停新开100M带宽KVM套餐,新订单转而升级为新的Budget KVM VPS(SSD)系列,带宽为1Gbps端口,且配置大幅升级,目前100M带宽仅保留OpenVZ架构产品可新订购,所有原有主机不变,用户一直续费一直可用。Bud...

阿里云年中活动最后一周 - ECS共享型N4 2G1M年付59元

以前我们在参与到云服务商促销活动的时候周期基本是一周时间,而如今我们会看到无论是云服务商还是电商活动基本上周期都要有超过一个月,所以我们有一些网友习惯在活动结束之前看看商家是不是有最后的促销活动吸引力的,比如有看到阿里云年中活动最后一周,如果我们有需要云服务器的可以看看。在前面的文章中(阿里云新人福利选择共享性N4云服务器年79.86元且送2月数据库),(LAOZUO.ORG)有提到阿里云今年的云...

鲸云10美元,香港BGPRM 1核 1G 10Mbps峰值带宽 1TB流量,江西CN2-NAT 1核 512MB内存 100M带宽 ,

WHloud Official Notice(鲸云官方通知)(鲸落 梦之终章)]WHloud RouMu Cloud Hosting若木产品线云主机-香港节点上新预售本次线路均为电信CN2 GIA+移动联通BGP,此机型为正常常规机,建站推荐。本次预售定为国庆后开通,据销售状况决定,照以往经验或有咕咕的可能性,但是大多等待时间不长。均赠送2个快照 2个备份,1个默认ipv4官方网站:https:/...

java代码大全为你推荐
订房系统求酒店开房系统旺旺群发手机旺旺怎么群发信息?郭列90后三无人物,如何创业?如何去实现人生价值?broadcast播播……拼音云输入法QQ云输入法的候选窗口是什么样的?sms是什么短信验证是什么?cursorlocation如何用ENVI把不同图像中的相同地点的某个像素点的值读出来。按时间把这个点的值连起来,。谢谢好人。全局钩子求助:全局钩子是怎么回事啊?下载的游戏为什么会安装钩子?求大神帮助全局钩子delphi 键盘全局钩子医院排队系统医院排队机和医院排队机的区别有哪些?
高防服务器租用qy 工信部域名备案查询 德国vps 过期域名抢注 naning9韩国官网 5折 justhost 香港vps99idc vmsnap3 godaddy域名优惠码 京东商城0元抢购 赞助 双11秒杀 免费美国空间 电信托管 raid10 google台湾 smtp服务器地址 东莞主机托管 114dns 更多