`
Data168
  • 浏览: 3176 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

Error Collections in Java

    博客分类:
  • Java
阅读更多

本文记录遇到的各种Java报错提示。

 

1.Cannot make a static reference to the non-static field  无法在静态方法中引用非静态变量 。

public class Test {
	byte aa;
	short bb;
	int cc;
	long dd;
	double ee;
	float ff;
	boolean gg;
	char hh;
	
	public static void main(String[] args){
		
		System.out.println("the value of aa is :" + aa);
		System.out.println("the value of aa is :" + aa);
		
	}
}

 把实例变量加上static修饰符就好了。

public class Test {
	static byte aa;
	static short bb;
	static int cc;
	static long dd;
	static double ee;
	static float ff;
	static boolean gg;
	static char hh;
	
	public static void main(String[] args){
		
		System.out.println("the value of aa is :" + aa);
		System.out.println("the value of bb is :" + bb);
		System.out.println("the value of cc is :" + cc);
		System.out.println("the value of dd is :" + dd);
		System.out.println("the value of ee is :" + ee);
		System.out.println("the value of ff is :" + ff);
		System.out.println("the value of gg is :" + gg);
		System.out.println("the value of hh is :" + hh);
				
	}
}

 

分享到:
评论

相关推荐

    Java.7.A.Comprehensive.Tutorial

    Designed as a guidebook for those who want to become a Java developer, Java 7: A Comprehensive Tutorial discusses the essential Java programming topics that you need to master in order teach other ...

    java面试题及技巧4

    │ │ ├─Low Level Security in Java.files │ │ │ Desktop_.ini │ │ │ JAVA.85.gif │ │ │ s_code_remote.js │ │ │ │ │ └─SCJP 1_4 认证的初级教程.files │ │ bg-gold.gif │ │ c(1).gif │ │...

    java面试题目与技巧1

    │ │ ├─Low Level Security in Java.files │ │ │ Desktop_.ini │ │ │ JAVA.85.gif │ │ │ s_code_remote.js │ │ │ │ │ └─SCJP 1_4 认证的初级教程.files │ │ bg-gold.gif │ │ c(1).gif │ │...

    java面试题以及技巧

    │ │ ├─Low Level Security in Java.files │ │ │ Desktop_.ini │ │ │ JAVA.85.gif │ │ │ s_code_remote.js │ │ │ │ │ └─SCJP 1_4 认证的初级教程.files │ │ bg-gold.gif │ │ c(1).gif │ │...

    Learning Android: Develop Mobile Apps Using Java and Eclipse(第二版)

    Error/Exception Handling Complex Example Interfaces and Inheritance Collections Generics Threads Summary Chapter 3 The Stack Stack Overview Linux Native Layer Dalvik Application Framework Applications...

    Addison.Wesley.The.Java.Programming.Language.4th.Edition.Aug.2005.chm

    or changes to classes and methods caused by the addition of generics (such as the collections utilities and the reflection classes)change permeates this entire fourth edition. <br>The Java ...

    java 面试题 总结

    JAVA相关基础知识 1、面向对象的特征有哪些方面 1.抽象: 抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用...

    dom4j-2.1.3.jar

    官方最新版本,支持Java 8+。 dom4j是一个Java的XML API,是jdom的升级品,用来读写XML文件的。dom4j是一个十分优秀的Java...XML Document Object Model based on Java Collections Framework Java 8+ Generics support

    java面试宝典

    64、Collection 和 Collections的区别 17 65、Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别 17 66、HashMap和Hashtable的区别 17 67、说出ArrayList,Vector, ...

    java面试题及技巧3

    │ │ ├─Low Level Security in Java.files │ │ │ Desktop_.ini │ │ │ JAVA.85.gif │ │ │ s_code_remote.js │ │ │ │ │ └─SCJP 1_4 认证的初级教程.files │ │ bg-gold.gif │ │ c(1).gif │ │...

    java面试题以及技巧6

    │ │ ├─Low Level Security in Java.files │ │ │ Desktop_.ini │ │ │ JAVA.85.gif │ │ │ s_code_remote.js │ │ │ │ │ └─SCJP 1_4 认证的初级教程.files │ │ bg-gold.gif │ │ c(1).gif │ │...

    JDK 1.5的泛型實現(Generics in JDK 1.5)

    Java Collections。 . 本文適用工具: JDK1.5 . 本文程式源碼可至侯捷網站下載 http://www.jjhou.com/javatwo-2004-reflection-and-generics-in-jdk15-sample.ZIP . 本文是 JavaTwo-2004技術研討會同名講...

    超级有影响力霸气的Java面试题大全文档

    超级有影响力的Java面试题大全文档 1.抽象: 抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。...

    JDBC Developers Guide Reference.rar

    Oracle Collections" This chapter discusses the Oracle extensions to standard JDBC that let you access and manipulate arrays and their data. xxi Chapter 11, "Accessing PL/SQL Index-by Tables" This ...

    Scala for the Impatient 2nd (完整英文第二版 带书签)

    13.14 Interoperability with Java Collections 191 13.15 Parallel Collections 193 Exercises 194 14 PATTERN MATCHING AND CASE CLASSES A2 197 14.1 A Better Switch 198 14.2 Guards 199 14.3 Variables in ...

    Professional C# 3rd Edition

    Error Handling with Exceptions 16 Use of Attributes 17 Assemblies 17 Private Assemblies 18 Shared Assemblies 19 Reflection 19 .NET Framework Classes 19 Namespaces 21 Creating .NET Applications Using ...

    千方百计笔试题大全

    64、Collection 和 Collections的区别 17 65、Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别 17 66、HashMap和Hashtable的区别 17 67、说出ArrayList,Vector, ...

    DWR.xml配置文件说明书(含源码)

    4 Signatures in dwr.xml Signatures部分用于配置Collections中装载对象元素的类型.举个例子来说:下面的java代码没有办法对List集合中的对象进行转换. public class Check { public void setLotteryResults(List ...

    python3.6.5参考手册 chm

    What’s New in Python What’s New In Python 3.6 Summary – Release highlights New Features PEP 498: Formatted string literals PEP 526: Syntax for variable annotations PEP 515: Underscores in ...

    driving_wxthxy

    Logger.e("error"); Logger.w("warning"); Logger.v("verbose"); Logger.i("information"); Logger.wtf("wtf!!!!"); String format arguments are supported Logger.d("hello %s", "world"); Collections support ...

Global site tag (gtag.js) - Google Analytics