object = new Object(int something);
for(int i=0;i<5;i++) {
//obj=queue.element();
obj=queue.remove();
object=obj.runTasks(int somethingElse);
queue.offer(obj);
//queue.remove();
}
기본적으로 객체의 메소드를 대기열에서 먼저 사용하고 대기열의 뒤에 넣고 다음 객체를 사용하려고합니다. 등 큐에서 마지막 한대기열에서 객체의 메소드 사용하기, Java
예를 들어, 경고의 많은 프로그램이 종료 "글 예외"AWT-EventQueue의-0 "을 발생 object=obj.runTasks(int...)
선 것이
이러한 :.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at projekt.Modell.körSaker(Modell.java:110) at projekt.Controller$CloseListener.actionPerformed(Controller.java:84) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
누구에게도 해결책이 있습니까? 감사합니다.
코드를 붙여도 컴파일되지 않습니다.를 참조하십시오. 'Object' 란 무엇입니까? Controller.java의 84 번째 줄에 무엇이 있습니다. – Bozho
분명히 전체 코드를 추가하지 않았습니다. Controller.java의 84 행은 위의 코드가 들어있는 메소드를 호출합니다. Modell.java:110은 object = obj.runTasks (int somethingElse)입니다. 나는 방금 변수를 포함하는 것보다 읽기 쉽도록했다고 생각했습니다. – Rickard