package test;

public class abc {

public static void main(String[] arg)

{

int[][] xx=new int[3][];

xx[0]=new int[3];

xx[1]=new int[2];

xx[2]=new int[1];

for(int i=0;i<xx.length;++i)

for(int j=0;j<xx[i].length;++j)

xx[i][j]=j;

for(int[] i1:xx)

for(int j:i1)

System.out.println(j);

System.out.println(">>>>>>>>>>>");

int [][] x={{1,2,3},{1,2},{1}};

System.out.println(x[1][1]);

}

}

package test2_class;

public class student {

String sName;

String sNumber;

int sage;

public String getsName() {

return sName;

}

public void setsName(String sName) {

this.sName = sName;

}

public String getsNumber() {

return sNumber;

}

public void setsNumber(String sNumber) {

this.sNumber = sNumber;

}

public int getSage() {

return sage;

}

public void setSage(int sage) {

this.sage = sage;

}

void eat()

{

System.out.println(sName+" have lunch");

}

void sleep()

{

System.out.println(sName+" sleep");

}

public boolean equals(Object obj)

{

student s=(student)obj;

if(sName==s.sName&&sage==s.sage&&sNumber==s.sName)

{

return true;

}

return false;

}

public String toString()

{

return "name:"+sName+"\t"+"age:"+sage+"\t"+"number:"+sNumber;

}

}

package test2_class;

public class Main {

public static void main(String[] args)

{

student t=new student();

t.setsName("zhangsan");

t.setSage(15);

t.setsNumber("2678");

System.out.println(t.getSage());

System.out.println(t.getSage());

System.out.println(t.getSage());

t.eat();

t.sleep();

if(t.equals(t))

System.out.println("equal");

System.out.println(t);

}

}

package string_practice;

public class string_practice {

public static void main(String[] args) {

// TODO Auto-generated method stub

String str3="HELLO";

String str4="HELLO";

String str1=new String("HELLO");

String str2=new String("HELLO");

if(str3==str4)

{

System.out.println("equals");

}

if(str1.equals(str2))

{

System.out.println("equals");

}

Integer a = new Integer(1);

}

}

类方法中不能访问非static变量.

导入的两个包有相同名的类,则不导入

final定义常量的关键

JAVA_2Lesson的更多相关文章

随机推荐

  1. Java之SPI机制

    之前开阿里的HSF框架,里面用到了Java的SPI机制,今天闲暇的时候去了解了一下,通过写博客来记录一下 SPI的全名为Service Provider Interface,我对于该机制的理解是为接口 ...

  2. 「OC」 继承

    一.基本用法 1.设计两个类Bird.Dog 1 // Bird的声明 2 @interface Bird : NSObject 3 { 4 @public 5 int weight; 6 } 7 - ...

  3. HDU 2023题解分析

    我想说这道题我还没弄明白我错哪了,交了20多遍一直都是Runtime Error,改了N次还是不对,后来搜了一下,说是数组开小了,又把数组开大,还不对,又改发现一个平均值求错,再改,还不对,洗洗睡吧. ...

  4. 模仿jquery的一些实现

    wylUtil.js //w作为window的形参,就表示window (function(w) { // 定义一个全局的window.wyl变量,就类似于jquery里的$,Jquery对象 w.w ...

  5. Windows Phone 8初学者开发—第6部分:设置应用程序的样式

    原文 Windows Phone 8初学者开发—第6部分:设置应用程序的样式 Source Code: http://aka.ms/absbeginnerdevwp8  PDF Version: ht ...

  6. Codeforces AIM Tech Round (Div. 2)

    这是我第一次完整地参加codeforces的比赛! 成绩 news standings中第50. 我觉这个成绩不太好.我前半小时就过了前三题,但后面的两题不难,却乱搞了1.5h都没有什么结果,然后在等 ...

  7. BZOJ 1621: [Usaco2008 Open]Roads Around The Farm分岔路口

    题目 1621: [Usaco2008 Open]Roads Around The Farm分岔路口 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 56 ...

  8. CUDA samples 第三章 sample reference 概况

    示例代码分为下列几类: 1.   Simple Reference 基础CUDA示例,适用于初学者, 反应了运用CUDA和CUDA runtime APIs的一些基本概念. 2.   Utilitie ...

  9. COM组件

    COM组件   COM component(COM组件)是微软公司为了计算机工业的软件生产更加符合人类的行为方式开发的一种新的软件开发技术.在COM构架下,人们可以开发出各种各样的功能专一的组件,然后 ...

  10. Spring IOC和DI原理讲解并制作LazyCoder版的Spring (一)

    转载请注意出处:http://blog.csdn.net/zcm101 写在前面的话 最近,给项目组成员培训了Spring 控制反转和依赖注入的原理,并自己做了个Lazy Coder版的Spring, ...