`

Cannot make a static reference to the non-static field email

阅读更多
     之所以会报Cannot make a static reference to the non-static field email这个错,是因为在静态方法中,不能直接访问非静态成员(包括方法和变量)。因为,非静态的变量是依赖于对象存在的,对象必须实例化之后,它的变量才会在内存中存在。
       因此,这个东西解决起来特别简单,第一种,可以把变量改成静态的。第二种,先实例化对象,然后使用对象名.变量名来调用即可。
分享到:
评论

相关推荐

    数据结构从应用到实现(java版)课后习题答案

    A static method cannot reference a non-static field in its class. Because the non-static field must associate with an instance of the class but the static method can be called even when no instances ...

    [EN]emWin534

    emWin 设计用于提供高效且独立于处理器和显示控制器的图形用户界面,用于任何使用图形显示进行 操作的应用。它与单任务和多任务环境、专用操作系统或具有任何商业RTOS 兼容,emWin 的发货 形式为C 语言源代码。...

    acpi控制笔记本风扇转速

    The disassembler now emits a comment if a buffer appears to be a ResourceTemplate, but cannot be disassembled as such because the EndTag does not appear at the very end of the buffer. AcpiExec - ...

    self-tuning UDF Cost Modeling Using the Memory-Limited Quadtree

    properties of the quadtree and add the following in order to make the quadtree useful for UDF cost modeling: the abilities to (1) adapt to changing UDF execution patterns and (2) use limited memory. ...

    SSD7 选择题。Multiple-Choice

    (a) the name of the table and the amount of storage space to be allocated to the table (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the ...

    PC-lint 9.0 -- Gimpel.Software.PC-lint.9.0a

    You have permission to print out the Reference Manual (or other related documentation) in whole or in part in support of the use of this software. ------ Support for Microsoft through Visual ...

    The connected J-Link is defective,Proper operation cannot be guaranteed

    解决 The connected J-Link is defective,Proper operation cannot be guaranteed keil5版本比较高时debug会出现以上错误,替换安装文件下的segger 可以解决

    MS-DOS 5.0

    to the User's Guide and Reference. For information about using applications with MS-DOS 5.0, see the APPNOTE.TXT file. 2. SOLVING SETUP PROBLEMS ========================= 2.1 Priam and Everex ...

    A-Practical-Guide-to-LATEX-Tips.pdf

    but to give a quick reference to all the tips and tricks that can be used if you are encountering a (difficult) problem, or simply facing a question which you cannot find the answer to. I consider ...

    file-5.15-mips32r1-linux-static.tar.xz

    # ./configure --host=arm-unknown-linux-uclibcgnueabi --prefix=/usr --disable-warnings --disable-shared --enable-static LDFLAGS="--static -s" 2、mips平台 # ./configure --host=mips-unknown-linux-uclibc ...

    Senfore_DragDrop_v4.1

    to ask for help via email, but I cannot guarantee that I will have time to help you or even reply to your mail. If you absolytely can't live without my help, you can alway try bribing me. You can ...

    brew_install

    官方源安装brew 缓慢 安装容易失败,这个脚本是替换过源(将官方源替换成了清华源 brew bottle)下载后直接运行: ruby brew_install

    The MySQL server is running with the --read-only option so it cannot execute this statement

    1209 - The MySQL server is running with the --read-only option so it cannot execute this statement

    解决 cannot find -lxxx 的问题

    解决 cannot find -lxxx 的问题

    markdown_to_asciidoc-1.0.jar

    mvn install:install-file -DgroupId=nl.jworks.markdown_to_asciidoc -DartifactId=markdown_to_asciidoc -Dversion=1.0 -Dpackaging=jar -Dfile=C:\Users\lizz\Downloads\markdown_to_asciidoc-1.0.jar

    make-3.82.tar.gz

    Some systems' Make programs are broken and cannot process the Makefile for GNU Make. If you get errors from your system's Make when building GNU Make, try using `build.sh' instead. GNU Make is free ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Correct use of header files can make a huge difference to the readability, size and performance of your code. The following rules will guide you through the various pitfalls of using header files. ...

    Git-2.21.0-64-bit.zip

    * A new tag.gpgSign configuration variable turns "git tag -a" into "git tag -s". * "git multi-pack-index" learned expire and repack subcommands. * "git blame" learned to "ignore" commits in the ...

    计算机网络第六版答案

    Most packet-switched networks today (including the Internet) cannot make any end-to-end guarantees for bandwidth. FDM requires sophisticated analog hardware to shift signal into appropriate frequency...

    a project model for the FreeBSD Project.7z

    Often used more narrowly in reference to an external deliverable, which is a deliverable that is subject to approval by the project sponsor or customer” by [PMI, 2000]. Examples of outcomes are a ...

Global site tag (gtag.js) - Google Analytics