課程
/后端開(kāi)發(fā)
/Java
/Java入門第二季 升級(jí)版
請(qǐng)將代碼發(fā)給我
2016-09-24
源自:Java入門第二季 升級(jí)版 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的用戶管理系統(tǒng)");
System.out.println("---------------------");
System.out.println("用戶登錄---------------1");
System.out.println("用戶注冊(cè)---------------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("用戶注冊(cè)界面");
System.out.println("=====================");
System.out.println("請(qǐng)輸入您的用戶名:");
String name2=input.next();
?name=name2;
?System.out.println("請(qǐng)輸入您的密碼:");
int mima2=input.nextInt();
mima=mima2;
System.out.println("請(qǐng)輸入您的郵箱");
String email2=input.next();
email=email2;
System.out.println("用戶注冊(cè)成功");}
do { ?i=0;?
System.out.println("用戶登錄界面");
? ? ? ?System.out.println("===================");
? ? ? ?System.out.println("請(qǐng)輸入您的用戶名:");
? ? ? ?String name1=input.next();
? ??
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? if ? (name1.equals(name)){
? ? ? ? ? ? System.out.println("請(qǐng)輸入您的密碼:");
? ? ? ? ? ? ? ? int mima1=input.nextInt();
? ? ? ? ? ? if (mima1==mima){
? ? ? ? ? ? System.out.println("登錄成功。。。");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("歡迎登錄主窗體");
? ? ? ? ? ? System.out.println(name1+"你好"+" ? ? ? ? ? ?"+"您的權(quán)限是:普通用戶");
? ? ? ? ? ? System.out.println("修改自己的信息-------------1");
? ? ? ? ? ? System.out.println("查詢自己的信息-------------2");
? ? ? ? ? ? System.out.println("程序退出-----------------3");
? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ?
? ? ? ? ? ? else?
? ? ? ? ? ? {System.out.println("輸入的密碼有誤請(qǐng)重新輸入");
? ? ? ? ? ? ? ? ? ? ?i=1; } ? ? ? ?
? ? ? ? ? ? }
? ? ? ? ? ? else{ ?
? ? ? ? ? ? System.out.println("輸入的用戶名有誤請(qǐng)重新輸入");
? ? ? ? ? ? ? ? ? ? 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);
? ? ? ? ? ? ??? ? ? ? ?
? ??? ? ? ? ? ? ?
}}
//估計(jì)不行,不太會(huì)使用跳轉(zhuǎn)語(yǔ)句。
老王學(xué)java
輸出NULL說(shuō)明你定義的字符串沒(méi)有賦值成功,而輸出了一個(gè)默認(rèn)值。提示請(qǐng)輸入名字后你可以這么寫(xiě):
String name = input.nextLine();?
不一定是input,看你用Scanner創(chuàng)建實(shí)例是后用的是什么變量名。
我登陸上了,但名字卻變成了NULL,這是為什么
- - 沒(méi)這閑工夫
舉報(bào)
課程升級(jí)!以終為始告別枯燥,在開(kāi)發(fā)和重構(gòu)中體會(huì)Java面向?qū)ο缶幊痰膴W妙
3 回答求大神賜教
4 回答請(qǐng)大神賜教
4 回答求大神教??!
2 回答求教大神大師
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
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的用戶管理系統(tǒng)");
System.out.println("---------------------");
System.out.println("用戶登錄---------------1");
System.out.println("用戶注冊(cè)---------------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("用戶注冊(cè)界面");
System.out.println("=====================");
System.out.println("請(qǐng)輸入您的用戶名:");
String name2=input.next();
?name=name2;
?System.out.println("請(qǐng)輸入您的密碼:");
int mima2=input.nextInt();
mima=mima2;
System.out.println("請(qǐng)輸入您的郵箱");
String email2=input.next();
email=email2;
System.out.println("用戶注冊(cè)成功");}
do { ?i=0;?
System.out.println("用戶登錄界面");
? ? ? ?System.out.println("===================");
? ? ? ?System.out.println("請(qǐng)輸入您的用戶名:");
? ? ? ?String name1=input.next();
? ??
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? if ? (name1.equals(name)){
? ? ? ? ? ? System.out.println("請(qǐng)輸入您的密碼:");
? ? ? ? ? ? ? ? int mima1=input.nextInt();
? ? ? ? ? ? if (mima1==mima){
? ? ? ? ? ? System.out.println("登錄成功。。。");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("歡迎登錄主窗體");
? ? ? ? ? ? System.out.println(name1+"你好"+" ? ? ? ? ? ?"+"您的權(quán)限是:普通用戶");
? ? ? ? ? ? System.out.println("======================");
? ? ? ? ? ? System.out.println("修改自己的信息-------------1");
? ? ? ? ? ? System.out.println("查詢自己的信息-------------2");
? ? ? ? ? ? System.out.println("程序退出-----------------3");
? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ?
? ? ? ? ? ? else?
? ? ? ? ? ? {System.out.println("輸入的密碼有誤請(qǐng)重新輸入");
? ? ? ? ? ? ? ? ? ? ?i=1; } ? ? ? ?
? ? ? ? ? ? }
? ? ? ? ? ? else{ ?
? ? ? ? ? ? System.out.println("輸入的用戶名有誤請(qǐng)重新輸入");
? ? ? ? ? ? ? ? ? ? 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);
? ? ? ? ? ? ??? ? ? ? ?
? ? ? ? ? ? ?
? ??? ? ? ? ? ? ?
}}
//估計(jì)不行,不太會(huì)使用跳轉(zhuǎn)語(yǔ)句。
2016-10-12
輸出NULL說(shuō)明你定義的字符串沒(méi)有賦值成功,而輸出了一個(gè)默認(rèn)值。提示請(qǐng)輸入名字后你可以這么寫(xiě):
String name = input.nextLine();?
不一定是input,看你用Scanner創(chuàng)建實(shí)例是后用的是什么變量名。
2016-10-05
我登陸上了,但名字卻變成了NULL,這是為什么
2016-09-24
- - 沒(méi)這閑工夫