Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

错误原因:内部类不应该和外部类同名。 解决方法:更改外部类名称或内部类名称

Well, english is not my main language, im sorry, but if im understanding you good Necrodoom i need to write a line that check if the sender is a player, then if true, apply the effect to the player?

Home » Newcomers » Newcomers » [error] The nested type cannot hide an enclosing type([error] The nested type cannot hide an enclosing type) [] Sun, 23 October 2011 13:46

Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
Jonathan Camilleri Messages: 91 Registered: July 2009

Member

package javabeat.samples;

public class VolatileExample {

class ExampleThread extends Thread { private volatile int testValue; public ExampleThread(String str){ super(str); } public void run() { for (int i = 0; i < 3; i++) { try { System.out.println(getName() + " : "+i); if (getName().equals("Thread 1 ")) { testValue = 10; } if (getName().equals("Thread 2 ")) { System.out.println( "Test Value : " + testValue); } Thread.sleep(1000); } catch (InterruptedException exception) { exception.printStackTrace(); } } } } public class VolatileExample { public static void main(String args[]) { new ExampleThread("Thread 1 ").start(); new ExampleThread("Thread 2 ").start(); } }

}

Sourced from http://www.javabeat.net/tips/169-volatile-keyword-in-java.html.

Error message: The nested type VolatileExample cannot hide an enclosing type

  • Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
    Attachment: VolatileExample.rar (Size: 2.88KB, Downloaded 200 times) [ is a reply to ] Sun, 23 October 2011 15:16
    Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
    Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
    On 2011.10.23 7:46, Jonathan Camilleri wrote: \> package javabeat.samples; \> \> public class VolatileExample { \> \> class ExampleThread extends Thread { \> [snip]

Is there a specific question in here somewhere?

Note that this forum is for handling issues mostly related to newcomers to Eclipse. It is not a forum for answering questions about Java. For that, you'd best head for javaranch.com, jguru.com or stackoverflow.com--all great forums that answer very quickly and expertly.

[ is a reply to ] Mon, 24 October 2011 17:36

Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
Lỗi the nested type giamdoc cannot hide an enclosing type năm 2024
Eric Rizzo Messages: 3070 Registered: July 2009

Senior Member

On 10/23/11 11:16 AM, Russell Bateman wrote: \> On 2011.10.23 7:46, Jonathan Camilleri wrote: \>> package javabeat.samples; \>> \>> public class VolatileExample { \>> \>> class ExampleThread extends Thread { \>> [snip] \> \> Is there a specific question in here somewhere? \> \> Note that this forum is for handling issues mostly related to newcomers \> to Eclipse. It is not a forum for answering questions about Java. For \> that, you'd best head for javaranch.com, jguru.com or \> stackoverflow.com--all great forums that answer very quickly and expertly.

Russell is right. I can tell you, however, that you simply have a transcription error - the code you linked to is NOT the same as the code you posted.

Eric

Goto Forum:

Current Time: Wed Jun 26 09:36:49 GMT 2024

Powered by FUDForum. Page generated in 0.08255 seconds