- 1、本文档共16页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Java生成绩查询系统
Chap 2
实践2-1
class Ex2_1{
public static void main(String[] args) {
float sum=0.0f,count=1.0f;
for(int i=1;i=20;++i){
count=1.0f;
for(int j=1;j=i;++j)
count*=j;
sum+=count;
}
System.out.println(1+2!+3!+...+20!的值为:+sum);
}
}
实践2-2
public class Ex2_2{
public static void main(String[] args) {
System.out.println(** 菲波拉挈数列的前20个数为:**);
long f1 = 1, f2 = 1;
for (int i = 1; i = 10; i ++) {
System.out.print(f1 + + f2 + );
if (i % 2 == 0) {
System.out.println();
}
f1 = f1 + f2;
f2 = f2 + f1;
}
}
}
Chap 3
实践3-1
public class Student
{ static String name=张三;
static int age;
public Student()
{
age=18;
}
public static void main(String args[])
{
System.out.println(姓名:+name+,年龄:+age);
}
}
实践3-2
class People{
String name;
People(String name){
=name ; //对成员变量name 初始化
}
}
class Student extends People{
String stuID;
Student(String name,String stuID){
super(name) ; //对继承自父类的成员变量name初始化
this.stuID=stuID ; //对成员变量stuID 初始化
}
}
public class PeopleDemo{
public static void main(String arg[]) {
Student stu=new Student(张三 ; //定义对象
System.out.println(+ +stu.stuID) ; //输出对象的姓名和学号
}
}
Chap 4
实践4-1
public class Ex4_1 {
String str;
public Ex4_1(String str) {
this.str = str;
}
int getlength(){
return(str.length());
}
public static void main(String[] args) {
Ex4_1 test = new Ex4_1(Hello);
System.out.println(字符串是:+test.str+ 长度为:+test.getlength());
}
}
实践4-2
import java.util.*;
import java.io.*;
public class Ex4_2{
public static void main(String[] args) {
String str1 = new String();
String str2 = new String();
char ch;
Scanner reader= new Scanner(System.in);
System.out.println(输入字符串:);
str1=reader.next(); //输入字符串
System.out.println(输入要删除的字符:);
str2=reader.next(); //输入穿要删除的字符 ,以字符串的形式输入
ch=str2.charAt(0);
您可能关注的文档
- BES报系统手册.doc
- BHL集团T项目团队管理研究.doc
- bios中置U盘启动方式.docx
- BIOS设从U盘启动.doc
- BRC-化验操作规程.doc
- Bqqoddq工商管理、经济管理专毕业论文选题参考.doc
- BIM技培训手册.doc
- BOM表查询VB实现方法.doc
- BSCI商业社会任准则体系说明.doc
- BPXZ-BY便携式电缆耐试验装置说明书.doc
- 中国国家标准 GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- 《GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计》.pdf
- 中国国家标准 GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- 《GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置》.pdf
- 中国国家标准 GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- GB/T 17889.4-2024梯子 第4部分:铰链梯.pdf
- 《GB/T 17889.4-2024梯子 第4部分:铰链梯》.pdf
文档评论(0)