执一不失,能君万物http://weidian.com/s/284520723?wfr=c
分类: Java
2015-06-24 11:18:40
点击(此处)折叠或打开
kvoice19702016-01-27 00:22:06
package cn.kvoice1970.cycle_structure;
import java.util.Scanner;
public class SwitchTest1 {
public static void main(String[] args) {
System.out.println(\"请输入一个字符串\");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
switch (input) {
case \"hello\":
System.out.println(\"您输入的是hello\");
bre
kvoice19702016-01-26 23:19:30
//键盘录入,
import java.util.Scanner;
public class SwtichDemo {
public static void main(String[] args) {
// 创建Scanner对象;
Scanner sc = new Scanner(System.in);
System.out.println(\"请输入数值1-7\");
int week = sc.nextInt();
switch (week) {
case 1:
System.out.println(\"星期一\");
break;
case 2: