• 13


    1
    package cty;

    public class PersonArray {
    public static void main(String args[])
    {
    person per[]=new person[3];
    per[0]=new person("XA",20);
    per[1]=new person("XB",22);
    per[2]=new person("XC",23);
    for (int x=0;x<per.length;x++)
    {
    per[x].getinfo();
    }
    }
    }

    2

    packageCTY;

    public class person {
    private String name;
    private int age;
    public person(String name,int age)
    {
    this.name=name;
    this.age=age;
    }
    public void getinfo()
    {
    System.out.println("姓名: "+this.name+" 年龄: "+this.age);
    }


    }

    3

    package CTY;

    public class A {
    public void getFibonacci(int number){
    int nLeft = 0;
    int nRight = 1;
    System.out.print(nRight);
    for (int i = 0; i < number; i++) {
    int sum = nLeft + nRight;
    System.out.print(" " + sum);
    nLeft = nRight;
    nRight = sum;
    }
    }
    public static void main(String[] args) {
    new A().getFibonacci(10);
    }

    }

    4

    package CTY;

    public class A {
    public static void main(String[] args) {
    int[] arr={23,234,3,1,19,21,231,88,90,11};
    for(int i=0;i<arr.length-1;i++) {
    for(int j=i+1;j<10;j++) {
    if(arr[i]>arr[j]) {
    int temp;
    temp=arr[i];
    arr[i]=arr[j];
    arr[j]=temp;
    }
    }
    }
    for(int i=0;i<arr.length;i++){
    System.out.println(arr[i]);

    }

    }
    }

    5

    packageCTY;

    public class A {
    public static int main(String[] args) {
    int[] arr={23,234,3,1,19,21,231,88,90,11};
    for(int i=0;i<10;i++) {
    for(int j=0;j<10-1-i;j++) {
    if(arr[j]>arr[j+1]) {
    int temp;
    temp=arr[j];
    arr[j]=arr[j+1];
    arr[j+1]=temp;
    }

    }
    }
    for(int i=0;i<arr.length;i++){
    System.out.println(arr[i]);
    }
    return 0;

    }
    }

    packagecty;

    public class StaticDemo 
    {
    public static void main(String args[])
    {
    new StaticDemo().fun();
    }

    private void fun() {
    System.out.println("XXXXXXXX!!");
    }
    }

    2.packageCTY;

    public class RL 
    {
    private String name;
    private int age;
    public RL(String name,int age){
    this.name =name;
    this.age =age;
    }
    public boolean compare(RL r) {
    if(this.name.equals(r.name)&&this.age==r.age) {
    return true;
    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    3.package CTY;

    public class CRL {
    public static void main(String args[]) {
    RL r1 = new RL("XX",30);
    RL r2 = new RL("XX",30);
    if(r1.compare(r2)) 
    {
    System.out.println("SAMEXX!!");
    }
    }

    }

    4.package CTY;

    public class aa {
    private int age;
    private String name;
    public aa(String name,int age) {
    this.name =name;
    this.age =age;
    }
    public boolean compare(aa l) {
    if(this==l) {
    return true;
    }
    if(this.name.equals(l.name)&&this.age==l.age) {
    return true;

    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    5.

    packageCTY;

    public class Person {
    private String name;
    private String age;
    public Person(String name,String i)
    {
    this.name=name;
    this.age=i;
    }
    public Person(String name2, int i) 
    {

    }
    public String getName() {
    return this.name;
    }

    public String getAge() 
    {
    return this.age;
    }
    };

    packagecty;

    public class StaticDemo 
    {
    public static void main(String args[])
    {
    new StaticDemo().fun();
    }

    private void fun() {
    System.out.println("XXXXXXXX!!");
    }
    }

    2.packageCTY;

    public class RL 
    {
    private String name;
    private int age;
    public RL(String name,int age){
    this.name =name;
    this.age =age;
    }
    public boolean compare(RL r) {
    if(this.name.equals(r.name)&&this.age==r.age) {
    return true;
    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    3.package CTY;

    public class CRL {
    public static void main(String args[]) {
    RL r1 = new RL("XX",30);
    RL r2 = new RL("XX",30);
    if(r1.compare(r2)) 
    {
    System.out.println("SAMEXX!!");
    }
    }

    }

    4.package CTY;

    public class aa {
    private int age;
    private String name;
    public aa(String name,int age) {
    this.name =name;
    this.age =age;
    }
    public boolean compare(aa l) {
    if(this==l) {
    return true;
    }
    if(this.name.equals(l.name)&&this.age==l.age) {
    return true;

    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    5.

    packageCTY;

    public class Person {
    private String name;
    private String age;
    public Person(String name,String i)
    {
    this.name=name;
    this.age=i;
    }
    public Person(String name2, int i) 
    {

    }
    public String getName() {
    return this.name;
    }

    public String getAge() 
    {
    return this.age;
    }
    };

    packagecty;

    public class StaticDemo 
    {
    public static void main(String args[])
    {
    new StaticDemo().fun();
    }

    private void fun() {
    System.out.println("XXXXXXXX!!");
    }
    }

    2.packageCTY;

    public class RL 
    {
    private String name;
    private int age;
    public RL(String name,int age){
    this.name =name;
    this.age =age;
    }
    public boolean compare(RL r) {
    if(this.name.equals(r.name)&&this.age==r.age) {
    return true;
    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    3.package CTY;

    public class CRL {
    public static void main(String args[]) {
    RL r1 = new RL("XX",30);
    RL r2 = new RL("XX",30);
    if(r1.compare(r2)) 
    {
    System.out.println("SAMEXX!!");
    }
    }

    }

    4.package CTY;

    public class aa {
    private int age;
    private String name;
    public aa(String name,int age) {
    this.name =name;
    this.age =age;
    }
    public boolean compare(aa l) {
    if(this==l) {
    return true;
    }
    if(this.name.equals(l.name)&&this.age==l.age) {
    return true;

    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    5.

    packageCTY;

    public class Person {
    private String name;
    private String age;
    public Person(String name,String i)
    {
    this.name=name;
    this.age=i;
    }
    public Person(String name2, int i) 
    {

    }
    public String getName() {
    return this.name;
    }

    public String getAge() 
    {
    return this.age;
    }
    };

    packagecty;

    public class StaticDemo 
    {
    public static void main(String args[])
    {
    new StaticDemo().fun();
    }

    private void fun() {
    System.out.println("XXXXXXXX!!");
    }
    }

    2.packageCTY;

    public class RL 
    {
    private String name;
    private int age;
    public RL(String name,int age){
    this.name =name;
    this.age =age;
    }
    public boolean compare(RL r) {
    if(this.name.equals(r.name)&&this.age==r.age) {
    return true;
    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    3.package CTY;

    public class CRL {
    public static void main(String args[]) {
    RL r1 = new RL("XX",30);
    RL r2 = new RL("XX",30);
    if(r1.compare(r2)) 
    {
    System.out.println("SAMEXX!!");
    }
    }

    }

    4.package CTY;

    public class aa {
    private int age;
    private String name;
    public aa(String name,int age) {
    this.name =name;
    this.age =age;
    }
    public boolean compare(aa l) {
    if(this==l) {
    return true;
    }
    if(this.name.equals(l.name)&&this.age==l.age) {
    return true;

    }else {
    return false;
    }
    }
    public String getName() {
    return this.name;
    }
    public int getAge() {
    return this.age;
    }
    }

    5.

    packageCTY;

    public class Person {
    private String name;
    private String age;
    public Person(String name,String i)
    {
    this.name=name;
    this.age=i;
    }
    public Person(String name2, int i) 
    {

    }
    public String getName() {
    return this.name;
    }

    public String getAge() 
    {
    return this.age;
    }
    };

     

  • 相关阅读:
    十一周
    第五次作业
    第十周
    测试作业
    2016.06.24-2016.06.30这周工作时间和内容
    2016.06.10-2016.06.16这周工作时间和内容
    2016.06.03-2016.06.09这周工作时间和内容
    2016.05.26-2016.06.02这周工作时间和内容
    2016.05.20-2016.05.26这周工作时间和内容
    分答
  • 原文地址:https://www.cnblogs.com/Archon-Cty/p/7903582.html
Copyright © 2020-2023  润新知