本文介绍了我如何让它工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

唔'回答'而无法找到。



代码块添加 - OriginalGriff [/ edit]



我尝试过:



  import  java.io. *; 
public class 人{
private String name;
private String 地址;
private String tel_no;
private String answer;


public Person( String 名称,字符串地址,字符串 tel_no,字符串 answer){
.name = name;
.address = address;
this .tel_no = tel_no;
.answer = answer;
}
}
class 栏{
public static void main( String [] args ) throws IOException {
BufferedReader k = new BufferedReader( new InputStreamReader
(System 。在));
执行 {
System.out.print( 请输入名称:);
String name = k.readLine(); // 本地变量
System.out.print( 请输入地址;);
String address = k.readLine();
System.out.print( 请输入电话号码:); // 处理行尾字符
String tel_no = k.readLine();
System.out.print( 请输入答案:);
String answer = k.readLine();
// 在构造函数调用中使用局部变量
Person person = new 人(姓名,地址,tel_no,答案);
} while (answer.equals( ));
}
}
解决方案

Well 'answer' on while is cannot be found.

[edit]Code block added - OriginalGriff[/edit]

What I have tried:

import java.io.*;
public class Person {
    private String name;
    private String address;
    private String tel_no;
    private String answer;


  public Person(String name, String address, String tel_no, String answer) {
    this.name = name;
    this.address = address;
    this.tel_no = tel_no;
    this.answer = answer;
  }
}
class Bar {
    public static void main(String[] args) throws IOException {
    BufferedReader k=new BufferedReader(new InputStreamReader
            (System.in));
  do{
    System.out.print("Please enter name: ");
    String name=k.readLine( );  // local variable
    System.out.print("Please enter address; ");
    String address=k.readLine( );
    System.out.print("Please enter phone number: " ); // to handle the end of line characters
    String tel_no =k.readLine( );
    System.out.print("Please enter answer: ");
    String answer=k.readLine( );
    // use local variables in constructor call
    Person person = new Person(name, address, tel_no, answer);
    }while(answer.equals("yes"));
    }
}
解决方案


这篇关于我如何让它工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 01:24