更多"请在每条横线处填写一个语句,使程序的功能为:判断输入的年份是否为闰年("的相关试题:
[简答题]请在每条横线处填写一个语句,使程序的功能为:判断输入的年份是否为闰年(例如:1998年不是闰年,2000年是闰年).
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
import java.io.*;
public class LeapYear
public static void main(String args[])
___________________;
BufferedReader in;
ir=new InputStreamReader(_____________________________);
in=new BufferedReader(ir);
System. out. print In("输入年份是: ");
String s=in.readline( );
int year=___________________
if(year%4==0&&year%100!=0||year%400==0
System.out.println(" "+year+" "年是闰年. ");
else
System.out.println(" " +year+ " "年不是闰年.");
[简答题]下面的程序是用do_while语句计算10的阶乘。请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class DoWhileLoop{
public static void main(______) {
int n=10;
long result=1
do
{
______
{
______
System. out. println("10的阶乘为:"+result);
}
}
[简答题]下面的程序是用do__while语句计算10的阶乘。请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class DoWhileLoop{
public static void main(_____________){
int n=10;
long result=1;
do
{
__________________
}
__________________
System. out.println( "10的阶乘为: "+result);
}
}
[简答题]请在每条横线处填写一个语句,使程序的功能完整,且输出结果为911。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class Outer
{
public static void main(String args[])
{
Outer i = new Outer( );
i.taskInner( );
}
public class Inner
{
private int size;
public void doSomething(int size)
{
____________________//访问局部变量
this.size++;//访问内部类的成员变量
____________________//访问外部类的成员变量
System.out.println(size+" "+this.size+" "+Outer.this.size);
}
}
public void taskInner( )
{
__________________
k.doSomething(8);
}
private static int size;
}
[简答题]请在每条横线处填写一个语句,使程序的功能完整,且输出结果为91 1。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
源程序文件代码清单如下:
public class Outer
public static void main (String args[]
Outer i = new Outer( );
i,taskInner( );
public class Inner
private int size;
public void doSomething(int size)
_____________//访问局部变量
this. size++; //访问内部类的成员变量
_____________//访问外部类的成员变量
System.out.println(size+" "+this.size+" "+Outer.this.size);
public void taskInner( )
___________
k.doSomething(8);
private static int size;
[简答题]请在下面程序中的每条横线处填写一个语句,使程序的功能完整。程序的输出结果为:
TIME=1867
b=9
i=123
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
import java.io.*;
public class DataType{
public______________void main(String args[])
{
byte b;
int i;//定义变量i为int类型
___________________________ //定义常量TIME为整型,且值为1867
i=123;//给变量i赋值,该值为十进制的123
__________________________________//给变量赋值,改值为,八进制的11,十进制的9
System.out.println("TIME”+TIME);
System.out.println("b="+b);
System.out.println("i="+i);
}
}
[简答题]请在下面程序中的每条横线处填写一个语句,使程序的功能完整。程序的输出结果为:
TIME=1867
b=9
i=123
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
源程序文件代码清单如下:
import java.io.*;
public class DataType
public ______ void main(String args[])
byte b;
int i;//定义变量i为int类型
______//定义常量TIME为整型,且值为1867
i=123;//给变量i赋值,该值为十进制的123
______//给变量赋值,改值为八进制的11,十进制的9
System.out.println("TIME"+TIME);
System.out.println("b="+b);
System.out.println("i="+i);
[简答题]下面是关于字符界面基本输入输出的程序,请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
______________________
public class SimpleCharInOut{
public static void main(String args[]){
char c=" ";
System.out.println("Enter a character please: ");
try{
____________________//接受用户键盘输入的字符并保存在变量c中
}
catch(________________________e){}
System.out.println("You’ve entered character "+c);
}
}
[简答题]下面程序执行后,输出结果为:true请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class TestStringCompare{
{public static void main(String ____________________ args)
{char charl[]={’t’,’e’,’s’,’t’};
char char2[]={’t’,’e’,’s’,’t’,’1’};
String str1=new String(___________________);
String str2=new String(char2,0,4);
System.out.println(__________________________);
}
}
[简答题]下面的程序的功能是简单的进行键盘输入测试,请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
____________________
public class TestKeyBoardInPut
{public static void main(String[] args)
{String yourname=JOptionPane. ____________________ ("What is your name");
System.out.println("Hello"+yourname);
____________________.exit(0);
}
}
[简答题]下面的程序是求字符串的长度及每一个位置上的字符。请在每条横线处填写一条语句,使程序的功能完整。
注意;请勿改动main( )主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class CharAtOp{
public static void main(String args[ ]){
String str="abcdef";
int size=
System.out.println("字符串str的长度为: "+size);
for(int m=0;___________________m++)
{
_______________________
System.out.println("str中的第"+m+"个字符是: "+c);
}
}
}