課程
/后端開發
/Java
/Java入門第二季 升級版
請將代碼發給我
2016-09-24
源自:Java入門第二季 升級版 8-5
正在回答
package com;
import java.util.Scanner;
public class Damo {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("歡迎使用neusoft的用戶管理系統");
System.out.println("---------------------");
System.out.println("用戶登錄---------------1");
System.out.println("用戶注冊---------------2");
System.out.println("退出程序---------------3");
Scanner input=new Scanner(System.in);
int a=input.nextInt();
String name="admin";
int mima=8888;
String email="";
int i;
int o=0;
do{
if(a==2){
System.out.println("用戶注冊界面");
System.out.println("=====================");
System.out.println("請輸入您的用戶名:");
String name2=input.next();
?name=name2;
?System.out.println("請輸入您的密碼:");
int mima2=input.nextInt();
mima=mima2;
System.out.println("請輸入您的郵箱");
String email2=input.next();
email=email2;
System.out.println("用戶注冊成功");}
do { ?i=0;?
System.out.println("用戶登錄界面");
? ? ? ?System.out.println("===================");
? ? ? ?System.out.println("請輸入您的用戶名:");
? ? ? ?String name1=input.next();
? ??
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? if ? (name1.equals(name)){
? ? ? ? ? ? System.out.println("請輸入您的密碼:");
? ? ? ? ? ? ? ? int mima1=input.nextInt();
? ? ? ? ? ? if (mima1==mima){
? ? ? ? ? ? System.out.println("登錄成功。。。");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("歡迎登錄主窗體");
? ? ? ? ? ? System.out.println(name1+"你好"+" ? ? ? ? ? ?"+"您的權限是:普通用戶");
? ? ? ? ? ? System.out.println("修改自己的信息-------------1");
? ? ? ? ? ? System.out.println("查詢自己的信息-------------2");
? ? ? ? ? ? System.out.println("程序退出-----------------3");
? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ?
? ? ? ? ? ? else?
? ? ? ? ? ? {System.out.println("輸入的密碼有誤請重新輸入");
? ? ? ? ? ? ? ? ? ? ?i=1; } ? ? ? ?
? ? ? ? ? ? }
? ? ? ? ? ? else{ ?
? ? ? ? ? ? System.out.println("輸入的用戶名有誤請重新輸入");
? ? ? ? ? ? ? ? ? ? i=1;}
? ? ? ? ? ? ? ? } while(i>=1);
?
? ? ? ? ? ? ? ? ?int b=input.nextInt();
? ? ? ? ? ? ? ? ?if (b==2){System.out.println("用戶名為"+name);
? ? ? ? ? ? ? ? ?System.out.println("密碼為"+mima);
? ? ? ? ? ? ? ? ?System.out.println("郵箱為"+email);
? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? if(b==1){ o=1; }
}
? ? ? ? ? ? ? ? ?while (o>=1);
? ? ? ? ? ? ??? ? ? ? ?
? ??? ? ? ? ? ? ?
}}
//估計不行,不太會使用跳轉語句。
老王學java
輸出NULL說明你定義的字符串沒有賦值成功,而輸出了一個默認值。提示請輸入名字后你可以這么寫:
String name = input.nextLine();?
不一定是input,看你用Scanner創建實例是后用的是什么變量名。
我登陸上了,但名字卻變成了NULL,這是為什么
- - 沒這閑工夫
舉報
課程升級!以終為始告別枯燥,在開發和重構中體會Java面向對象編程的奧妙
3 回答求大神賜教
4 回答請大神賜教
4 回答求大神教??!
2 回答求教大神大師
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-11-12
package com;
import java.util.Scanner;
public class Damo {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("歡迎使用neusoft的用戶管理系統");
System.out.println("---------------------");
System.out.println("用戶登錄---------------1");
System.out.println("用戶注冊---------------2");
System.out.println("退出程序---------------3");
Scanner input=new Scanner(System.in);
int a=input.nextInt();
String name="admin";
int mima=8888;
String email="";
int i;
int o=0;
do{
if(a==2){
System.out.println("用戶注冊界面");
System.out.println("=====================");
System.out.println("請輸入您的用戶名:");
String name2=input.next();
?name=name2;
?System.out.println("請輸入您的密碼:");
int mima2=input.nextInt();
mima=mima2;
System.out.println("請輸入您的郵箱");
String email2=input.next();
email=email2;
System.out.println("用戶注冊成功");}
do { ?i=0;?
System.out.println("用戶登錄界面");
? ? ? ?System.out.println("===================");
? ? ? ?System.out.println("請輸入您的用戶名:");
? ? ? ?String name1=input.next();
? ??
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? if ? (name1.equals(name)){
? ? ? ? ? ? System.out.println("請輸入您的密碼:");
? ? ? ? ? ? ? ? int mima1=input.nextInt();
? ? ? ? ? ? if (mima1==mima){
? ? ? ? ? ? System.out.println("登錄成功。。。");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("歡迎登錄主窗體");
? ? ? ? ? ? System.out.println(name1+"你好"+" ? ? ? ? ? ?"+"您的權限是:普通用戶");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("修改自己的信息-------------1");
? ? ? ? ? ? System.out.println("查詢自己的信息-------------2");
? ? ? ? ? ? System.out.println("程序退出-----------------3");
? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ?
? ? ? ? ? ? else?
? ? ? ? ? ? {System.out.println("輸入的密碼有誤請重新輸入");
? ? ? ? ? ? ? ? ? ? ?i=1; } ? ? ? ?
? ? ? ? ? ? }
? ? ? ? ? ? else{ ?
? ? ? ? ? ? System.out.println("輸入的用戶名有誤請重新輸入");
? ? ? ? ? ? ? ? ? ? i=1;}
? ? ? ? ? ? ? ? } while(i>=1);
?
? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ?int b=input.nextInt();
? ? ? ? ? ? ? ? ?if (b==2){System.out.println("用戶名為"+name);
? ? ? ? ? ? ? ? ?System.out.println("密碼為"+mima);
? ? ? ? ? ? ? ? ?System.out.println("郵箱為"+email);
? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? if(b==1){ o=1; }
}
? ? ? ? ? ? ? ? ?while (o>=1);
? ? ? ? ? ? ??? ? ? ? ?
? ? ? ? ? ? ?
? ??? ? ? ? ? ? ?
}}
//估計不行,不太會使用跳轉語句。
2016-10-12
輸出NULL說明你定義的字符串沒有賦值成功,而輸出了一個默認值。提示請輸入名字后你可以這么寫:
String name = input.nextLine();?
不一定是input,看你用Scanner創建實例是后用的是什么變量名。
2016-10-05
我登陸上了,但名字卻變成了NULL,這是為什么
2016-09-24
- - 沒這閑工夫