• 11.20


    package lzb;
    public class LIUZHIBO
    {
    public static void main(String[] args) { int[] arr = new int [30]; arr[0] = 1; arr[1] = 1; for(int i = 2;i < arr.length;i++) arr[i] = arr[i-1] + arr[i-2]; for(int i : arr) System.out.println(i); } }

     package LZB;
     
     public class LIUZHIBO666 {
              public static void main(String[] args) { 
              int[] arr={1,3,2,45,65,33,12}; 
              System.out.println("交换之前:");
              for(int num:arr){ 
              System.out.print(num+" "); 
              } 
              for(
            int i = 0; i < arr.length - 1; i++) {
            int k = i; 
            for(int j = k + 1; j < arr.length; j++){
            if(arr[j] < arr[k]){  
    k = j; } } if(i != k){ int temp = arr[i]; arr[i] = arr[k]; arr[k] = temp;
    } } System.out.println(); System.out.println("交换后:"); for(int num:arr){ System.out.print(num+" "); } } }

     1 package LZB;
     2 
     3 public class lzb666 {
     4     public static void main(String[] args) 
     5     { int[] arr={12,45,23,67,56,34,99,123}; 
     6     System.out.println("排序前数组为:"); 
     7     for(int num:arr)
     8     { 
     9     System.out.print(num+" "); 
    10     } 
    11     for(int i=0;i<arr.length-1;i++){
    12     for(int j=0;j<arr.length-1-i;j++){
    13     if(arr[j]>arr[j+1]){ 
    14     int temp=arr[j]; 
    15     arr[j]=arr[j+1]; 
    16     arr[j+1]=temp; 
    17     } 
    18     } 
    19     } 
    20     System.out.println(); 
    21     System.out.println("排序后的数组为:"); 
    22     for(int num:arr){ 
    23     System.out.print(num+" "); 
    24     } 
    25     } 
    26 }   

     1 package lzb;
     2 
     3 public class PersonArray {
     4     public static void main(String args[])
     5     {
     6         person per[]=new person[3];
     7         per[0]=new person("张三",20);
     8         per[1]=new person("李四",22);
     9         per[2]=new person("王五",23);
    10         for (int x=0;x<per.length;x++)
    11         {
    12             per[x].getinfo();
    13         }
    14     }
    15 }
    16 class person
    17 {
    18     private String name;
    19     private int age;
    20     public person(String name,int age)
    21     {
    22         this.name=name;
    23         this.age=age;
    24     }
    25     public void getinfo()
    26     {
    27         System.out.println("姓名: "+this.name+" 年龄: "+this.age);
    28     }
    29 }



    
    
  • 相关阅读:
    游戏《翻转方块》小攻略
    净捡软柿子捏--jQuery 遍历方法
    关于兼容
    sublime
    jQuery中json对象与json字符串互换
    css之IE透明度
    关于优化
    html5+css+div随时笔记
    css3学习--border
    JavaScript学习1
  • 原文地址:https://www.cnblogs.com/LiuZhibo999/p/7903795.html
Copyright © 2020-2023  润新知