「java传奇作业」一款叫传奇的java游戏
今天给各位分享java传奇作业的知识,其中也会对一款叫传奇的java游戏进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、Java作业
- 2、java简单作业题
- 3、JAVA的作业,求大神啊~
- 4、JAVA作业
Java作业
class Student {
private int studentNo;
private String name;
private int[] score;
public Student(int no, String name, int[] score){
this.studentNo = no;
this.name = name;
this.score = score;
}
public int getStudentNo(){
return this.studentNo;
}
public String getName() {
return this.name;
}
public int[] getScore() {
return this.score;
}
}
java简单作业题
public class MyDate {
private int year ;
private int month ;
private int day ;
public MyDate(){}
public MyDate(int year, int month, int day) {
super();
this.year = year;
this.month = month;
this.day = day;
}
public String toString() {
return "MyDate =="+year+"-"+month+"-"+day;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
}
public class MyTime {
public static void main(String[] args) {
MyTime time = new MyTime(14,53,20);
System.out.println(time.toString());
}
private int hour;
private int minute;
private int second;
public MyTime() {
}
public MyTime(int hour, int minute, int second) {
super();
this.hour = hour;
this.minute = minute;
this.second = second;
}
public String toString() {
return "current time=="+hour + ":" + minute + ":" + second;
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getMinute() {
return minute;
}
public void setMinute(int minute) {
this.minute = minute;
}
public int getSecond() {
return second;
}
public void setSecond(int second) {
this.second = second;
}
}
public class FullTime {
public static void main(String[] args) {
MyDate myDate = new MyDate(2007, 10, 2);
MyTime myTime = new MyTime(14,17,35);
FullTime fullTime = new FullTime(myDate,myTime);
System.out.println(fullTime);
}
private MyDate myDate;
private MyTime myTime;
public FullTime(MyDate myDate, MyTime myTime) {
super();
this.myDate = myDate;
this.myTime = myTime;
}
public String toString() {
String text = myDate.getYear() + "年" + myDate.getMonth() + "月"
+ myDate.getDay() + "日" + myTime.getHour() + "时"
+ myTime.getMinute() + "分" + myTime.getSecond() + "秒";
return text;
}
public MyDate getMyDate() {
return myDate;
}
public void setMyDate(MyDate myDate) {
this.myDate = myDate;
}
public MyTime getMyTime() {
return myTime;
}
public void setMyTime(MyTime myTime) {
this.myTime = myTime;
}
}
第4题,你自己想办法吧。主要知识点:
1、继承
2、super和final,这个只是表面的东西,说到底还是java中overrides(重写)的要求
3、通过多层间接的继承,你要知道的是 对象被实例化的顺序。
JAVA的作业,求大神啊~
public class Cube {
private float length;//长
private float width; //宽
private float height;//高
/**
* 构造方法
* 传递用户指定的长宽高
* @param length
* @param width
* @param height
*/
public Cube(float length, float width, float height) {
this.length = length;
this.width = width;
this.height = height;
}
/**
* 构造方法
* 始化立方体长宽高
*/
public Cube() {
this.length = 10f;
this.width = 10f;
this.height = 10f;
}
/**
* 修改长宽高的值
* @param length
* @param width
* @param height
*/
public void changeValue(float length, float width, float height){
this.length = length;
this.width = width;
this.height = height;
}
/**
* 计算体积
* @return
*/
public float volumeValue(){
return this.length*this.width*this.height;
}
public static void main(String[] args) {
//调用不同的方法进行测试
}
}
JAVA作业
1.1、System.out.println(a+b);
1.2、boolean,true;
2、public static intsumDigits(long n){
String tmp = n+"";
int total = 0;
for(int i=0;itmp.length;i++){
total+=Integer.parseInt(tmp.charAt(i)+"");
}
System.out.println(total);
}
3、
public class Calc {
public static void main(String[] args) {
System.out.println(calcNums());
}
public static int calcNums(){
int total = 0;
for(int i=1;i=100;i++){
total+=i;
}
return total;
}
}
4、
public class wendu {
public static void main(String[] args) {
System.err.println(toHuashi(78));
System.err.println(toSheshi(78));
}
public static float toHuashi(float c){
return (c*9/5)+32;
}
public static float toSheshi(float f){
return (f-32)*5/9;
}
}
5、
public static void judge(int score){
if(score60){
System.out.println("差");
}else if(score75){
System.out.println("中");
}else if(score90){
System.out.println("良");
}else{
System.out.println("优");
}
}
关于java传奇作业和一款叫传奇的java游戏的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。