【问题标题】:how to get output as "select * from employee" ,"select * from salaries","select * from student" and "select * from attendance" [closed]如何将输出作为“从员工中选择 *”、“从工资中选择 *”、从学生中选择 *”和“从出勤中选择 *”[关闭]
【发布时间】:2018-07-02 18:19:11
【问题描述】:

封装数组;

公开课 A {

public static void main(String[] args) {
    String[] arr = { "employee","salaries","student","attendance"};
    for (String x : arr)
    {
        System.out.println(x);
    }


}

} //输出: 员工 工资 学生 出席率

【问题讨论】:

    标签: java mysql


    【解决方案1】:

    system.out.println 行缺少您期望的描述。您需要添加要打印的语句。下面是编辑后的代码。

    package array;
    
    public class A {
    
    public static void main(String[] args) {
        String[] arr = { "employee","salaries","student","attendance"};
        for (String x : arr)
        {
            System.out.println("Select * from "+x);  // you need to edit this line
        }    
    }
    

    【讨论】:

      【解决方案2】:

      将您的 System.out.println 更改为

      System.out.println("select * from " + x);
      

      【讨论】:

        猜你喜欢
        • 2015-11-03
        • 2016-12-12
        • 2012-09-12
        • 2021-07-16
        • 1970-01-01
        • 2022-07-16
        • 1970-01-01
        • 1970-01-01
        • 2021-08-07
        相关资源
        最近更新 更多