我刚接触Java,只是想知道,使用默认的分隔符,age的值是多少? (请注意,我会在提示时输入值,然后以“输入”键结束)
输入年龄:14 45 20 16(然后按Enter键)
年龄的值是什么(14?16?14452016?),为什么?
答案 0 :(得分:0)
假设您在谈论select *
from (select w1.wk_id, (floor(td2.military_hour/4)*4) as military_hour_group , w1.end_date as end_date
from work_instances w1 inner join time_table td1 on w1.end_time = td1.time_id) table1 inner join (select (floor(td2.military_hour/4)*4) as td2_military_hour_group, (floor(td3.military_hour/4)*4) as td3_military_hour_group, wk_id
from task_instances t1 inner join time_table td2 on t1.end_time = td1.time_id inner join time_table td3 on t1.start_time = td3.time_id ) tabl2 on tabl2.td2_military_hour_group = table1.military_hour_group and tabl2.td3_military_hour_group = table1.military_hour_group and tabl2.wk_id = table1.wf_id
,则默认分隔符为空格。因此,如果您在命令行上输入“ 14 45 20 16”,然后按Enter键,则扫描程序实例上的java.util.Scanner
或nextInt
调用将返回14。如果您随后调用{{1 }}再次在扫描仪上,没有提示;将立即返回45。另外2个调用将分别返回20和16。如果您再第五次调用next
,则该调用将一直等到您键入内容。