下载此文档

java代码实例.docx


文档分类:IT计算机 | 页数:约33页 举报非法文档有奖
1/33
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/33 下载此文档
文档列表 文档介绍
第三章--数据类型、变量和表达式:
class ByteTest
{
public static void main ( String [] args )
{
int a;
byte b;
a=256;

b=(byte)a;
( b );
}
}
class FloatTest
{
public static void main ( String [] args )
{
float f;
f = ;
( f );
}
}
3.
import ;
public puteArea
{
public static void main(String[ ] args)
{
double radius;
double area;
radius = (("请输入半径值"));
area = radius * radius *;
(null,"area = "+ area);
}
}
第四章—控制:
1.
// : Contain the methods for reading int, double, and
// string values from the keyboard
import .*;
public class MyInput
{
// Read a string from the keyboard
public static String readString()
{
BufferedReader br
= new BufferedReader(new InputStreamReader(), 1);
// Declare and initialize the string
String string = " ";
// Get the string from the keyboard
try
{
string = ();
}
catch (IOException ex)
{
(ex);
}
// Return the string obtained from the keyboard
return string;
}
// Read an int value from the keyboard
public static int readInt()
{
return (readString());
}
// Read a double value from the keyboard
public static double readDouble()
{
return (readString());
}
// Read a byte value from the keyboard
public static double readByte()
{
return (readString());
}
// Read a short value from the keyboard
public static double readShort()
{
return (readString());
}
// Read a long value from the keyboard
public static double readLong()
{
return (readString());
}
// Read a float value from the keyboard
public static double readFloat()
{
return (readString());
}
}
2.
import .*;
public class pute
{
publi

java代码实例 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数33
  • 收藏数0 收藏
  • 顶次数0
  • 上传人mh900965
  • 文件大小29 KB
  • 时间2018-01-12