1 / 21
文档名称:

java基础题(java基础题).doc

格式:doc   大小:23KB   页数:21页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

java基础题(java基础题).doc

上传人:rjmy2261 2017/11/18 文件大小:23 KB

下载得到文件列表

java基础题(java基础题).doc

文档介绍

文档介绍:java基础题(java基础题)
1. Write statements, statements, or annotations plete the following tasks:
A) that a program pute the product of 3 integers.
B) create a Scanner object input. that reads data from a standard input device
C) declare int type variables X, y, Z, and result.
D) prompts the user to enter the first integer.
E) reads the first integer from the user input and stores it in the variable x.
F) prompts the user to enter second integers.
G) reads second integers from the user input and stores them in the variable y.
H) prompts the user to enter third integers.
I) reads third integers from the user input and stores them in the variant Z.
K) displays the value of the message "Product is" and the variable result.
Import ;
/ * *
* class name:
* Description: calculates the product of 3 integers
* /
Public class Product {
Public static void main (String[] args) {
Scanner input = new Scanner ();
Int x, y, Z, result;
("please input first integer to x:");
X = ();
("please input second integer to y:");
Y = ();
("please input third integer to z:");
Z = ();
Result = x*y*z;
("Product is" +result);
}
}
2, to achieve file replication function:
Requirements: write a Java program to copy C:\demo\ files to D:\dest\ and E:\dest\. .
Import ;
Import ;
Import ;
Import ;
Import ;
Import ;
Import ;
Import ;
/ * *
* class name:
Description: write a Java program to copy C:\demo\ files to D:\dest\ and E:\dest\. .
* /
Public class CopyZipFile {
Public static void CopyFile (InputStream inputStream, String destpath) {
File targetFile = new File (destpath