Weakly ask a question nullpointerexception

Updated on society 2024-04-30
8 answers
  1. Anonymous users2024-02-08

    You'll have to add the panel to the frame to display it, because you're using an AWT component, so you'll have one less frame.

    import ;

    public class testpanel{ First of all, the class name should be capitalized, and a meaningful name should be written.

    public static void main(string args)

    frame f = new frame();Define a framework.

    panel p = new panel();

    Add the panel to the frame.

    graphics g = ;

    You run down.

  2. Anonymous users2024-02-07

    Because your panel is not displayed, the graphics are not initialized, it is just a null reference, of course, it will cause a nullpointerexception, first put the panel in a container (such as frame), display it, and then call getgraphics().

  3. Anonymous users2024-02-06

    Panels cannot be displayed independently. You need to have a container to hold the panel, then setvisable(true) before you can instantiate graphics

  4. Anonymous users2024-02-05

    The most direct way to tell you is that you call one of its methods with a null object.

  5. Anonymous users2024-02-04

    Null pointer errors are arguably the easiest errors to deal with, and if you use MyEclipse or Eclipse development, you just need to put a breakpoint in the part of the program where you execute it, and the null pointer can be seen.

  6. Anonymous users2024-02-03

    The null pointer is abnormal, that is, the reference to your object is empty, but you want to use something in the object, so this error will be reported.

  7. Anonymous users2024-02-02

    I can only tell you that this is a null pointer exception, usually because the object is not initialized.

  8. Anonymous users2024-02-01

    Null pointer exception.

    It's not your problem, it's your phone's software, if you change it, you can change it.

    You can't fix it yourself.

Related questions
19 answers2024-04-30

Kamen Rider's biggest feature is its ability to be a single person, and the strength of the Armored Warriors is the power of unity, especially those five Light and Shadow Armor. So the strength of the nine Kamen Riders and the nine armored warriors is not comparable at all. Ultimate Emperor Man, God of War, and Shura Man can basically go head-to-head with any of the above Kamen Riders, but it is not necessarily the case with group fights.

18 answers2024-04-30

It was a traditional Chinese character, and it was during the Kuomintang control period, so the characters used at that time were just like the traditional Chinese characters used in Taiwan now. Because the Kuomintang did not carry out written reform after its defeat and flight to Taiwan. The mainland simplified Chinese character is a font produced by the simplification of Chinese characters on the basis of traditional Chinese characters in the People's Republic of China after the 1950s.

9 answers2024-04-30

Camel tea processing factory simple price: Zhenghe Gongfu is produced in northern Fujian, mainly in Zhenghe County and Songxi County. Zhenghe County, Songxi County mountains overlap, hills undulating, mild climate, abundant rainfall, annual average temperature, annual rainfall of more than 1600 mm, tea plantations are mostly opened up in the gentle slope of the forest traces, the soil layer is deep, slightly acidic, tea trees grow luxuriantly. >>>More

21 answers2024-04-30

It's best to change the power supply, it is recommended to use a 350W one, 300W is also enough!

41 answers2024-04-30

Not deliberately in favor of celibacy, but not against celibacy. >>>More