求助:Exception in thread "main" java.lang.NullPointerException [问题点数:20分,结帖人gahade]

Bbs1
本版专家分:1
Blank
黄花 2007年5月 MS-SQL Server大版内专家分月排行榜第二
Blank
蓝花 2007年4月 MS-SQL Server大版内专家分月排行榜第三
结帖率 100%
Bbs4
本版专家分:1051
Bbs1
本版专家分:1
Blank
黄花 2007年5月 MS-SQL Server大版内专家分月排行榜第二
Blank
蓝花 2007年4月 MS-SQL Server大版内专家分月排行榜第三
Bbs4
本版专家分:1051
Bbs7
本版专家分:11583
Blank
黄花 2004年10月 Java大版内专家分月排行榜第二
Bbs7
本版专家分:11583
Blank
黄花 2004年10月 Java大版内专家分月排行榜第二
Bbs1
本版专家分:1
Blank
黄花 2007年5月 MS-SQL Server大版内专家分月排行榜第二
Blank
蓝花 2007年4月 MS-SQL Server大版内专家分月排行榜第三
Bbs4
本版专家分:1051
Bbs1
本版专家分:1
Blank
黄花 2007年5月 MS-SQL Server大版内专家分月排行榜第二
Blank
蓝花 2007年4月 MS-SQL Server大版内专家分月排行榜第三
Bbs4
本版专家分:1051
Bbs1
本版专家分:1
Blank
黄花 2007年5月 MS-SQL Server大版内专家分月排行榜第二
Blank
蓝花 2007年4月 MS-SQL Server大版内专家分月排行榜第三
main" java.lang.NullPointerException">java程序抛出异常 Exception in thread "main" java.lang.NullPointerException
程序的全部代码如下: import java.awt.*; import java.awt.event.*; import java.net.*; import javax.swing.*; publ
main" java.lang.NullPointerException怎么解决">Exception in thread "main" java.lang.NullPointerException怎么解决
在以前的webservice中添加新的接口 项目是使用spring注解来实现依赖注入的, 写好方法后 在<em>main</em>方法中测试报错, 其他类都很正常, new的类调用时总是报空指针。。 注入哪里有问题 谢
main" java.lang.NullPointerException at Server.main(Server.java:22)">Exception in thread "main" java.lang.NullPointerException at Server.main(Server.java:22)
详见代码,结果如下: 正在监听Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at Server.<em>main</em>(Server.java:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
awt Swing项目添加鼠标监听事件时出现异常 Exception in <em>thread</em> &quot;AWT-EventQueue-0&quot; java.lang.NullPointerException     at day02.LoginFrame$MyActionListener.actionPerformed(LoginFrame.java:134)     at javax.swing.Abs...
main" java.lang.NullPointerException问题">Exception in thread "main" java.lang.NullPointerException问题
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 该问题多半是由于用到的某个对象只进行了声明,而没有初始化,即没有被new 比如说: 一个类Person,有一个对象p1 声明对象 Person p1; 使用该对象(调用它的某个方法等)  p1.setXXX(...); 这种情况下就会产生上述错误。 改正方法: 在使用
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
我做了一个cs结构的聊天程序,用了swing,hibernate。可是有时候会出现会出现下列异常,它也没说我程序的哪行出错, 我该怎么找错误啊。什么原因可能导致不报异常位置。 哪位仁兄帮帮忙,都困扰我
main" java.lang.NullPointerException怎么解决???">Exception in thread "main" java.lang.NullPointerException怎么解决???
class Student{ Subject a; Subject b; Subject c; class Subject{ String a="JAVA 考察"; String b="SQL 考试"
main" java.lang.NullPointerException的问题">Exception in thread "main" java.lang.NullPointerException的问题
[TOC]问题叙述 出现Exception in <em>thread</em> &amp;amp;quot;<em>main</em>&amp;amp;quot; java.lang.NullPointerException一般是因为指针为空,也就是说这个时候你要注意你的对象是否已经初始化(new)了 例如 ![例子Path类](https://img-blog.csdn.net/20180909120307226?watermark/2/text/aHR0cHM6Ly9ibG...
main" java.lang.NullPointerException报错原因">Exception in thread "main" java.lang.NullPointerException报错原因
今天写了这么一段代码: class Books{ String title; String author; } class BooksTestDrive{ public static void <em>main</em>(String [] args){ Books[] myBooks = new Books[3]; int x = 0; myBooks[0].title = &quot;java aaaa&quot;; my...
main" java.lang.NoClassDefFoundError">解决办法 Exception in thread "main" java.lang.NoClassDefFoundError
Exception in <em>thread</em> "<em>main</em>" java.lang.NoClassDefFoundError: test (wrong name: com/sapmonitor/unix/test)        at java.lang.ClassLoader.defineClass1(Native Method)        at java.lang.ClassLoader.defin
main" java.lang.NullPointerException">JDBC编程中出现这样的问题Exception in thread "main" java.lang.NullPointerException
package com.jdbc.dbutils; import java.sql.Connection; import java.sql.DriverManager; import java.sql
java.lang.NullPointerException这个怎么解决
import java.awt.Point; import javax.swing.JOptionPane; import java.text.DecimalFormat; class Triangl
main" java问题.lang.NullPointerException">关于Exception in thread "main" java问题.lang.NullPointerException
编译吧不报错 但执行 就会 出现 以下 内容 --------------------Configuration: -------------------- Exception in
main" java.lang.NullPointerException一例解决">Exception in thread "main" java.lang.NullPointerException一例解决
完整报错信息是: Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at scala.io.Source$.fromURL(Source.scala:141) at RunGeoTime$.<em>main</em>(RunGeoTime.scala:66) at RunGeoTime.<em>main</em>(RunGeoTime.scala) at ...
java编译中出现了Exception in threadmain" java.lang.UnsupportedClassVersionError
java编译中出现了Exception in <em>thread</em> “<em>main</em>&quot; java.lang.UnsupportedClassVersionError转载 2015年08月04日 09:59:139868这个问题确实是由较高版本的JDK编译的java class文件试图在较低版本的JVM上运行产生的错误。    1、解决措施就是保证jvm(java命令)和jdk(javac命令)版本一致。如果是l...
java.lang.NullPointerException 空指针异常 求解决
java.lang.NullPointerException com.psger.dao.UserBeanDao.getUserBeanByUsername(UserBeanDao.java:33)
main" java.lang.NullPointerException">出现Exception in thread "main" java.lang.NullPointerException
import java.io.Console;rnpublic class ConsoleDemo rnpublic static void <em>main</em> (String[] args) rnSystem.out.print("请输入名称: ");rnConsole console = System.console();rnString name = console.readLine();rnSystem.out.println("你输入的名称..." + name);rnrnrn/** Creates a new instance of ConsoleDemo */rnpublic ConsoleDemo() rnrnrnrnrn直接在命令行编译运行通过,jdk6环境rn在netbeans5.5中编译通过,运行出现错误,请大家帮忙看看rn错误提示如下 :rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrnat ConsoleDemo.<em>main</em>(ConsoleDemo.java:19)rn请输入名称:
main" java.lang.NullPointerException">运行时Exception in thread "main" java.lang.NullPointerException
这是我的源代码~不知道哪里错了~请教~谢谢rnimport java.io.*;rnpublic class Gradernrn public static void <em>main</em>(String args[])rn rn int num,average,num1,num2;rn char ch;rn FileInputStream fin;rn DataInputStream din=null;rn tryrn while ((ch=din.readChar())!='\n')rn rn fin=new FileInputStream("d:\\test\\1.txt");rn din=new DataInputStream(fin);rn ch=din.readChar();rn num1=din.readInt();rn num2=din.readInt();rn num=num1+num2;rn average=((num1+num2)/2);rn System.out.println(ch+num+average);rn rn System.out.println("输出完毕");rn rn catch (Exception e)rn rn System.out.println("Error!");rn rn rn rnrnrn运行出现Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException
main" java.lang.NullPointerException">求解:Exception in thread "main" java.lang.NullPointerException
直接上代码哈。视频里的例子,我编译通过了,但是运行就报这个错误,我找不到错误在哪儿啊。rnpackage zicheng;rnrnpublic class Josephu rnrn public static void <em>main</em>(String[] args)rn rn rn CycLink cyclink = new CycLink();rn cyclink.setLen(8);rn cyclink.creatLink();rn cyclink.setk(2);rn cyclink.setm(2);rn rn //cyclink.show();rn cyclink.play();rnrn rnrnrnclass Childrn int no;rn Child nextChild = null;rn public Child(int no)rn rn //给一个编号rn this.no=no;rn rn rnrn class CycLinkrnrn //先定义一个指向链表第一个小孩的引用rn Child firstchild = null;rn Child temp =null;rn int len = 0; //共有几个小孩rn int k=0;rn int m=0;rn rn //设置链表的大小rn public void setLen(int len)rn rn this.len = len;rn rn public void setk(int k)rn rn this.k=k;rn rn public void setm(int m)rn rn this.m=m;rn rn rn public void play()rn rn //1.知道开始数数的人rn for(int i=1;i
main" java.lang.NullPointerException">请教:Exception in thread "main" java.lang.NullPointerException
运行内容如下的UseDriver.java文件,rnrnrnimport java.sql.*;rnpublic class UseDriver rn public static void <em>main</em>(String[] args) rn String url = "jdbc:mysql://localhost/sql_test";rn String userName = "root";rn String password = " ";rn String sql = null;rn Connection conn = null;rn Statement stmt = null;rn try rn //第一步:加载驱动器rn Class.forName("com.mysql.jdbc.Driver");rn catch(ClassNotFoundException e) rn System.err.print("ClassNotFoundException");rn rn rn try rn //第二步:调用DriverManager.getConnection静态方法得到数据库连接rn conn = DriverManager.getConnection(url, userName, password);rn //创建Statement语句rn stmt = conn.createStatement();rn sql = "INSERT INTO student " +rn "VALUES('12', 'zhangjun', 'tianjin', '1981-01-01')";rn //使用Statement语句对象执行SQL语句rn stmt.executeUpdate("DELETE FROM student WHERE stu_id='12'");rn stmt.executeUpdate(sql);rn System.out.println("Insert a row successful!");rn catch(SQLException e) rn System.err.println("Insert SQLException");rn finally rn //关闭语句和数据库连接rn try rn stmt.close();rn conn.close();rn catch(SQLException e) rn System.err.println("Close SQLException");rn rn rn rn rnrnrnrnrn在DOS窗体下运行,不知怎么出现如下的错误,请问一下这可能是什么错误啊,谢谢!rnrnrnG:\>javac UseDriver.javarnrnG:\>java UseDriverrnInsert SQLExceptionrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at UseDriver.<em>main</em>(UseDriver.java:35)rn
main" java.lang.NullPointerException问题的解决">Hadoop---Exception in thread "main" java.lang.NullPointerException问题的解决
Hadoop---Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException问题的解决     Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException问题的解决  解决:   首先我们来分析下这个问题,我是使用debug测试看哪里是空的。     然后跑去百度...
main" java.lang.NullPointerException">连接数据库连接池 Exception in thread "main" java.lang.NullPointerException
今天测试数据库连接池发现一直是空指针错误。一般都是配置文件出了问题。找了半天才发现,在没有密码的情况下不要加入password=null,估计是没有加入关键字解析的。直接省去不写就好了 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/igeek2?useUnicode=true&amp;amp;character...
main" java.lang.NullPointerException,同时发现很多问题。">爬取数据,但是写入数据库时,提示Exception in thread "main" java.lang.NullPointerException,同时发现很多问题。
主函数 package com.company.spriderjd; import com.company.dao.ProductDao; import com.company.do<em>main</em>.Product; import com.google.gson.Gson; import org.apache.http.client.methods.CloseableHttpRespon...
main" java.lang.NullPointerException">Java报错异常-----Exception in thread "main" java.lang.NullPointerException
异常提示: Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1045) at java.awt.Container.add(Container.java:365) at com.Textarea.JT_area.(JT_area.ja
main\" java.lang.LinkageError错误的解决">Exception in thread \"main\" java.lang.LinkageError错误的解决
NULL 博文链接:https://utopialxw.iteye.com/blog/1138133
main" java.lang.NullPointerException">报错:Exception in thread "main" java.lang.NullPointerException
报错:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrnrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at org.shp.dao.InputData.getInt([color=#FF0000]InputData.java:20)[/color]rn at org.shp.dao.Menu.showMain(Menu.java:23)rn at org.shp.dao.Menu.(Menu.java:12)rn at org.shp.dao.Main.<em>main</em>(Main.java:5)rn我的InputData 中的第20 行是:rnrnif(!(str.matches("\\[d]"))) // 是对输入字符的校验,rnrn不知道是什么地方错了呀,各位大哥帮忙看看。。rnrn还有就是:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 是什么地方错了呀。。。
main" java.lang.NullPointerException">错误信息 Exception in thread "main" java.lang.NullPointerException
今天复习了以下hibernate 尽然出现Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at com.java.move.test.save(test.java:28)rn at com.java.move.test.<em>main</em>(test.java:10)rn错误rn废话不多说请观代码rn-------------------------------------------------------------------------------------------------------------------------------------------------------rn[code=java]package com.java.move;rnrnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.pb.hibernate.util.HibernateSessionFactory;rnrnpublic class test rn public static void <em>main</em>(String args[])rn save();rn rn public static void save()rn Grade g = new Grade();rn g.setGid(110701);rn g.setGname("计应一班");rn g.setGdesc("计算机应用一班");rn rn Student stu1 = new Student();rn stu1.setSid(11070101);rn stu1.setSname("大姑爷");rn stu1.setSex("男");rn rn Student stu2 = new Student();rn stu2.setSid(11070102);rn stu2.setSname("老婆婆");rn stu2.setSex("女");rn rn Session session = HibernateSessionFactory.getSessionFactory().openSession();rn Transaction tr = session.beginTransaction();rn session.save(g);rn session.save(stu1);rn session.save(stu2);rn tr.commit();rn session.close();rn rnrn[/code]rn如何?
main" java.lang.NullPointerException问题求助">Exception in thread "main" java.lang.NullPointerException问题求助
问题描述如下:rninit:rndeps-jar:rncompile:rnrun:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at sun.awt.image.codec.JPEGImageEncoderImpl.getDefaultJPEGEncodeParam(JPEGImageEncoderImpl.java:174)rn at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:205)rn at waterset.P4.createJpg(P4.java:26)rn at waterset.Main.<em>main</em>(Main.java:77)rnJava Result: 1rn成功生成(总时间:1 秒)rn源程序如下:rnpackage waterset;rnimport java.awt.*;rnimport java.awt.image.*;rnimport java.awt.AlphaComposite.*;rnimport java.io.*;rnimport javax.imageio.ImageIO;rnimport javax.swing.*;rnimport com.sun.image.codec.jpeg.*;rn/**rn *rn * @author Ownerrn */rnpublic class P4 rn BufferedImage image;rnrn public void createJpg(String path) rn try rn FileOutputStream fos = new FileOutputStream(path);rn BufferedOutputStream bos = new BufferedOutputStream(fos);rn JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);rn [color=#FF0000]encoder.encode(image);[/color] rn bos.close(); rn catch(FileNotFoundException fnfe) rn System.out.println(fnfe);rn catch(IOException ioe) rn System.out.println(ioe);rn rn rn public void overlapPictures(BufferedImage p1, BufferedImage p2,int startOverlap)rn int amountOverlap = p1.getWidth() - startOverlap;rn Graphics g =p1.getGraphics();rn Graphics2D g2 = (Graphics2D) g;rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,(float) 1.0f));rn g2.drawImage(p2,0,0,startOverlap,p1.getHeight(),null);rn g2.drawImage(p1,startOverlap,0,p1.getWidth(),p1.getHeight(),null);rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.5f));rn rn g2.drawImage(p2,startOverlap,0,p1.getWidth(),p2.getHeight(),0,0,amountOverlap,p2.getHeight(),null);rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,(float) 1.0f));rn g2.drawImage(p2,p1.getWidth(),0,p2.getWidth()+startOverlap,p2.getHeight(),amountOverlap,0,p2.getWidth(),p2.getHeight(),null);rn rn rnrnrnrnrnrnrn主类:rnpublic class Main rnpublic static void <em>main</em>(String[] args) rn File file1=new File("d:\\1A.jpg");rn File file2=new File("d:\\1B.jpg");rn P4 p1=new P4();rn P4 p2=new P4();rn P4 p3=new P4();rn try rn p1.image = ImageIO.read(file1);rn p2.image = ImageIO.read(file2);rn catch(IOException ioe) rn System.out.println(ioe);rn rn p3.overlapPictures(p1.image,p2.image,0);rn [color=#FF0000]p3.createJpg("d:\\waterset.jpg");[/color] rn rnrnrnrnrn请大家帮我看看怎么回事啊~~~~
main" java.lang.NullPointerException">求助问题:Exception in thread "main" java.lang.NullPointerException
出错祥细:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at awt.GridLayoutTest.init(GridLayoutTest.java:36)rn at awt.GridLayoutTest.(GridLayoutTest.java:24)rn at awt.GridLayoutTest.<em>main</em>(GridLayoutTest.java:57)rn程序如下:rnpackage awt;rnrnimport java.awt.Button;rnimport java.awt.Color;rnimport java.awt.Frame;rnimport java.awt.GridLayout;rnimport java.awt.Panel;rnimport java.awt.TextField;rnrnpublic class GridLayoutTest rn Frame frame = null;rn Panel pn,pm,pc,ps;rn String[] s = "7","8","9","/",rn "sprt","4","5","6",rn "*","%","1","2",rn "3","-","1/x","0",rn "+/-",".","+","=";rn String[] m = "MC","MR","MS","M+";rnButton[] bs = new Button[s.length];rnButton[] bm = new Button[m.length];rnTextField tf = new TextField("0.",150);rnrn public GridLayoutTest() rn init();rn rnrn private void init() rn frame = new Frame("计算器 v1.0");rn frame.setLayout(new GridLayout(4,5,3,3));rn for(int i=0;i
main" java.lang.NullPointerException">如何解决:Exception in thread "main" java.lang.NullPointerException
各位高手,本人新手上路.玩个简单的程序却遇到了个问题.编译时没报错,但是运行就有问题,麻烦大家帮忙看一下.小弟不胜感激!!! 源程序如下: package swing; import java.awt
连接oracle数据库,为什么报错java.lang.NullPointerException。
import java.sql.*; class sql { private static Connection con=null; private static Statement stmt=nul
java.lang.NullPointerException解决方法
严重: Exception starting filter struts2 java.lang.NullPointerException
main" java.lang.NullPointerException at brut.androlib.res.data.value.R">apk反编译 Exception in thread "main" java.lang.NullPointerException at brut.androlib.res.data.value.R
解决方法: 将ApkTool更新新版 地址:https://ibotpeaches.github.io/Apktool/
求助:Exception in thread "Thread-3" java.lang.NullPointerException
while (shapeListener.isMoveDownable(Shape.this)) rn moveDown();rn shapeListener.shapeMoveDown(Shape.this);rn try rn Thread.sleep(1000);rn catch (InterruptedException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rn rnrn public Shape() rn new Thread(new automaticFall()).start();rn rn把while 括号里面的改为true运行正常,但是改为指定的就出现如题的错误 是什么原因啊
main" java.lang.NullPointerException">提示错误Exception in thread "main" java.lang.NullPointerException
<em>main</em>文件rnpublic class MMain rn public static void <em>main</em>(String[] args)rn rn //tryrn Mankey[] mk=new Mankey[100];rn Mankey.Inroad(mk);rn System.out.println(Mankey.clean(mk)); rn //catch(Exception Ex);rn rn rnrnMankey文件rnpublic class Mankey rn public int num,prior,next;rn public Mankey()rn rn rn rn static void Inroad(Mankey[] m)rn rn int last=m.length;rn for (int i=0;i
main" java.lang.NullPointerException 怎么解决。">异常Exception in thread "main" java.lang.NullPointerException 怎么解决。
我写了一个两个机器通信的程序,这个服务器端的代码rn[code=Java]rnpackage mySocket;rnrn//服务器端程序rnimport java.io.*;rnimport java.net.*;rnimport java.awt.*;rnimport java.awt.event.*;rnrnpublic class Server1 extends Frame implements ActionListener rn Label label = new Label("输入信息");rn TextField tf = new TextField(20);rn TextArea ta = new TextArea();rn Panel panel = new Panel();// 创建面板对象rn ServerSocket server;rn Socket Client;rn InputStream DataIn;rn OutputStream DataOut;rnrn @SuppressWarnings("deprecation")rn public Server1() rn super("通信--服务器端");rn setSize(300, 180);rn panel.add(label);// 在面板上添加标签rn panel.add(tf);// 在面板上添加文本框rn tf.addActionListener(this);// 注册rn add("North", panel);// 在窗体上添加面板rn add("Center", ta);// 在窗体上添加文本区rn addWindowListener(new WindowAdapter() rn public void windowClosing(WindowEvent e) rn System.exit(0);rn rn );rn show();rn try rn server = new ServerSocket(8888);rn Client = server.accept();rn ta.append("已经和客户端建立连接:" + Client.getInetAddress().getHostName()rn + "\n\n");rn DataIn = Client.getInputStream();rn DataOut = Client.getOutputStream();rn catch (IOException ioe) rn rn while (true) rn try rn byte buff[] = new byte[512];// 缓冲数组rn DataIn.read(buff);rn String str = new String(buff);// 接受客户端发送的数据包rn ta.append("Client :" + str + "\n");rn ta.append("\n");rn catch (IOException ioe) rn rn rn rnrn public static void <em>main</em>(String args[]) rn new Server1();rn rnrn public void actionPerformed(ActionEvent e)// 事件处理程序rn rn try rn String str = new String(tf.getText());rn byte buf[] = str.getBytes();rn tf.setText(" ");rn DataOut.write(buf);rn ta.append("Server :" + str + "\n");rn catch (IOException ioe) rn rn rnrnrn[/code]rn运行有rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at mySocket.Server1.(Server1.java:46)rn at mySocket.Server1.<em>main</em>(Server1.java:56)rn这样的异常rn界面还是能出来的。rn初学java,大家帮忙看看。rn谢谢各位了。
main" java.lang.NullPointerException at company.insertAe">请教:Exception in thread "main" java.lang.NullPointerException at company.insertAe
[code=Java]rnrnpublic class company rn rn static employee intArray[] = null;rn static int i = 0;rn rn static void insertAemployee(employee A) rn intArray[i] = A;rn i ++;rn rn rn void deleteAemployee(String name)rn for(int m = 0;m < i; m ++)rn while(intArray[m].name == name)rn intArray[m] = null;rn rn rn rn rn void showPay(String name)rn double salary = 0;rn for(int m = 0;m < i; m ++)rn while(intArray[m].name == name)rn salary = intArray[m].countPay(intArray[m]);rn rn rn rn System.out.println("员工" + name + "的工资为:" + salary);rn rn rn rn static void showAllpay(company A)rn double allSalary = 0;rn for(int m = 0;m < i; m ++)rn allSalary = allSalary + intArray[m].countPay(intArray[m]);rn rn System.out.println("所有员工的工资和为:" + allSalary);rn rn rn rnpublic static void <em>main</em>(String[] args) rn rn company company1 = new company(); rn employee hourEmployee1 = new hourEmployee(200,10);rn employee hourEmployee2 = new hourEmployee(230,10); rn employee sellEmployee1 = new sellEmployee(5000);rn employee sellEmployee2 = new sellEmployee(200000);rn employee commonEmployee1 = new commonEmployee(205);rnrn rn insertAemployee(hourEmployee1);rn insertAemployee(hourEmployee2);rn insertAemployee(sellEmployee1);rn insertAemployee(sellEmployee2);rn insertAemployee(commonEmployee1);rn showAllpay(company1);rn rn rn employee headgearEmployee1 = new headgearEmployee(30);rn insertAemployee(headgearEmployee1);rn showAllpay(company1);rn rn rnrnrnrnrnrn[/code]
main" java.lang.ExceptionInInitializerError">Exception in thread "main" java.lang.ExceptionInInitializerError
问题描述:我在利用cxf生成wsdl并编写客户端访问 运行<em>main</em>方法时出现这个问题 报错信息: Exception in <em>thread</em> "<em>main</em>" java.lang.ExceptionInInitializerError at org.apache.axis.handlers.BasicHandler.&lt;clinit&gt;(BasicHandler.java:43) at org...
main" java.lang.RuntimeException: java.lang.NullPointerExc">Java 连接 HBASE 空指针异常 Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerExc
环境:Win10;JDK 1.7    jre 1.7HBASE : 1.1.2低版本eclipse参考信息 :https://community.hortonworks.com/questions/90267/unable-to-use-hbase-from-java-api.html报错信息:(建议:有些技术,百度上并不全面,可以在谷歌上搜索)Exception in <em>thread</em> &quot;<em>main</em>...
java.lang.NullPointerException 空指针异常之一:对象真的为空吗?
    在开发中,需要传入页面表单作为查询条件,在DAO层进行数据库的select操作,如果form为空,那么查询所有的数据出来,如果form不为空,那么查询满足form条件的数据。我们把这个开发需求形象化一点:一个学生登录教务处查看自己的成绩,刚登录成绩查询页面的时候,什么参数都没有(form没有值),看到的是他所有的成绩;当他在课程名称,课程所在学期(年),授课老师名字等输入框输入正常的数据后...
main" java.lang.NullPointerException 1 解决方法">ionic项目 Exception in thread "main" java.lang.NullPointerException 1 解决方法
Debug ionic项目的时候,报了这么一个错误: TypeError:undefinedisnotafunction 进入输出列表里查看,提示: MSBUILD : cordova-build error :Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 1 at org.gradle.wrapper.Gra...
main" java.lang.NullPointerException">Hadoop下载文件到本地报错Exception in thread "main" java.lang.NullPointerException
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.o...
main" java.lang.NullPointerException错误怎么解决">Exception in thread "main" java.lang.NullPointerException错误怎么解决
下面这段程序,编译没问题,但运行时候会报错rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at operation.GetFileInfo.getFileNum(GetFileInfo.java:20)rn at operation.ExtractOperation.extraction(ExtractOperation.java:11)rn at operation.ExtractOperation.<em>main</em>(ExtractOperation.java:30)rn报错定位在下面红色的语句上,我知道这是说有空指针存在,可是我找不到。rn麻烦大家帮我找找错误!!rnrn此外,我的程序是从html源代码中匹配文字,然后输入到文件parameter.txt中,有一次运行成功了,建立了txt文件,却没内容,麻烦大家帮个忙!谢谢!rnrn[code=Java]rnpublic class ExtractOperation rn static String filePath = "./source/";rn public void extraction(String filePath) throws IOExceptionrn GetFileInfo gfn = new GetFileInfo();rn filePath=filePath+gfn.getFileName(filePath)+"/";rn [color=#FF0000]long num = gfn.getFileNum(filePath); [/color] for(int i=1;i;//匹配参数名称 rn Pattern p1=Pattern.compile(s1);rn Matcher m1=p1.matcher(str);rn while(m1.find())rn rn String s=m1.group(); rn bw.write(s);rn rn bw.close(); rn rnrn[/code]rn
main" java.lang.NullPointerException">What's wrong ---Exception in thread "main" java.lang.NullPointerException
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at java.awt.Container.addImpl(Container.java:341)rn at java.awt.Container.add(Container.java:267)rn at Frame1.(Frame1.java:59)rn at Frame1.<em>main</em>(Frame1.java:69)rn请问这是什么错?
main" java.lang.NullPointerException">新人问题。Exception in thread "main" java.lang.NullPointerException
最近开始学习java, 做作业遇到理解不了的问题,请教一下。rn-----------------------------------------rnpublic class Assign3 rnrn public static void <em>main</em>(String[] args) rn // TODO Auto-generated method stubrn CodeBreaker a3 = new CodeBreaker();rn a3.display();rnrn // end of methodrn // end if classrnrn-----------------------------------rnpublic class CodeBreaker rn private CodeLetter letter1;rn private CodeLetter letter2;rn private CodeLetter letter3;rn rn public CodeBreaker()rn CodeLetter letter1 = new CodeLetter();rn CodeLetter letter2 = new CodeLetter();rn CodeLetter letter3 = new CodeLetter();rn letter1.display();rn letter2.display();rn letter3.display();rn System.out.println(); rn rnrn public void display()rn System.out.print("The code was "); rn letter1.display();rn letter2.display();rn letter3.display();rn rn rn// end of classrnrn-----------------------rnimport java.util.Random;rnrnpublic class CodeLetter rn private char letterValue;rn Random rnd = new Random();rn rn public CodeLetter()rn letterValue = (char) (rnd.nextInt(5)+'A');rn rn rn public void display()rn System.out.print(letterValue);rn rnrnrn---------------------------rn运行结果:rnDCBrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at CodeBreaker.checkGuess(CodeBreaker.java:18)rn at Assign3.<em>main</em>(Assign3.java:6)rnrn我的问题是,为什么在public class CodeBreaker里,同样是调用public class CodeLetter的public void display(),在public CodeBreaker()可以打印字母(DCB),但是在public void display()却出错,不能打印了呢?
main" java.lang.NullPointerException">初学者遇到问题~Exception in thread "main" java.lang.NullPointerException
各位大虾,帮帮忙,小女子初学java,就遇到想不明白的问题了:(rnimport java.awt.*;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnrnimport javax.swing.JButton;rnimport javax.swing.JFrame;rnimport javax.swing.JLabel;rnrnpublic class QRFrame extends JFramernrnrn QRFrame frame; rn public QRFrame()rn rn super("hello");rn Container cp=frame.getContentPane();rn JLabel labName=new JLabel("name"); rn cp.setLayout(new BorderLayout());rn cp.add(labName,BorderLayout.NORTH);rn rn rn rn public static void <em>main</em>(String[] args) rn rn JFrame frame=new QRFrame();rn frame.setSize(600,800);rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn frame.setVisible(true); rn rnrnrn错误如下:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at com.songlyric.QRFrame.(QRFrame.java:21)rn at com.songlyric.QRFrame.<em>main</em>(QRFrame.java:34)rn不明白,呜呜~
main" java.lang.NullPointerException at A.main(A.java:8)">Exception in thread "main" java.lang.NullPointerException at A.main(A.java:8)
public class A rn rn B b1; rn B b2=new B(); rn public static void <em>main</em>(String args[]) rn rn A a1=new A(); rn System.out.println(a1.b1.x); //这一行出错了rn System.out.println(a1.b2.x);rn rn rnrnclass B rn rn int x=10; rn rnrn请问对象作为成员必须要new一个空间吗?为什么会出现这样的错误。
main" java.lang.NoClassDefFoundError">解决问题:Exception in thread "main" java.lang.NoClassDefFoundError
解决问题: Exception in <em>thread</em> “<em>main</em>” java.lang.NoClassDefFoundError
java.lang.NullPointerException
之前一篇文章聊过异常排名《Java异常排行榜:哪个异常最常见?》,里面谈到国外一个网站对 Java 异常进行数据分析并排名,结果是 NullPointerException 排第一,本文正好对空指针异常做一个总结,希望对各位同学有所帮助。 在本文中,我展示了一个关于如何处理空指针异常的综合示例。在Java中,null 作为一个特殊值被对象引用,用来表示该对象当前指向的是一块未知内存数据。然而Nu...
main" java.lang.NullPointerException">如何解决Exception in thread "main" java.lang.NullPointerException
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import j
main" java.lang.NullPointerException错误求解">关于Exception in thread "main" java.lang.NullPointerException错误求解
package fddffd; class Customer { private int personcode,type,money; Customer(){} Customer(int t1,int
main" java.lang.NullPointerException……………………在线等。。。。。。。">Exception in thread "main" java.lang.NullPointerException……………………在线等。。。。。。。
写了一个关于链表的简单程序,出现RT的异常,高手指点一下。先谢了。代码如下:rn[code=Java]class Personrn public String name;rn public void setname(String b)rn name=b;rn rn String getname()rn return name;rn rnrnclass Node rn public Person person;rn public Node head;rn public Node next;rn public boolean isEmpty()rn return head==null;rn //判断链表是否为空rn public void printAll()rn Node tmp=head;rn if(isEmpty())rn System.out.println("这是一个空链表");rn while(tmp!=null)rn System.out.print(tmp.person.getname()+" ");rn tmp=tmp.next;rn rn //遍历链表打印结果rn rnrnrnpublic class LianBiao rn public static void <em>main</em>(String [] args)rn Node nod=new Node();rn nod.person.setname("qq");rn nod.next=new Node();rn nod.head=nod;rn Node tem=new Node();rn tem=nod.next;rn tem.person.setname("qw");rn nod.printAll();rn rn[/code]
main" java.lang.NullPointerException问题求教!">Exception in thread "main" java.lang.NullPointerException问题求教!
下面是源代码出现的异常是rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at com.qq.server.db.Text10.(Text10.java:58)rn at com.qq.server.db.Text10.<em>main</em>(Text10.java:39)rn58行是 jp2.add(jb2);,39行是Text10 text= new Text10();求教这问题怎么解决??rnrnrnrnpackage com.qq.server.db;rnimport javax.swing.*;rnimport javax.xml.soap.Text;rnrnimport java.awt.*;rnimport java.awt.event.*;rnimport java.util.*;rnimport java.sql.*;rn//完成一个迷你版的用户信息管理系统rnpublic class Text10 extends JFrame implements ActionListenerrn rn JPanel jp1,jp2;rn rn JLabel jl1;rn JButton jb1,jb2,jb3,jb4;rn JTable jt;rn JScrollPane jsp;rn JTextField jtf;rn rn rn Vector rowData, columnNames;rn //rowData用户来存放行数据rn //后者用来存放列明rn rn rn //数据库操作需要定义的变量rn PreparedStatement ps= null;rn Connection ct = null;rn ResultSet rs= null;rn rn String url="jdbc:sqlserver://127.0.0.1:1433;databaseName=QQ";rn String user="sa";rn String passwd="322008";rn /**rn * @param argsrn */rn public static void <em>main</em>(String[] args) rn // TODO Auto-generated method stubrn Text10 text= new Text10();rn rnrn public Text10()rn rn jp1=new JPanel();rn jtf=new JTextField(10);rn jb1 = new JButton("查询");rn jb1.addActionListener(this);rn jl1 = new JLabel("请输入名字:");rn rn jp1.add(jl1);rn jp1.add(jtf);rn jp1.add(jb1);rn rn jb2= new JButton("添加");rn jb3= new JButton("修改");rn jb4= new JButton("注销");rn rn rn jp2.add(jb2);rn jp2.add(jb3);rn jp2.add(jb4);rn rn //中间rn //设置列名rn columnNames= new Vector();rn columnNames.add("号码");rn columnNames.add("昵称");rn columnNames.add("性别");rn columnNames.add("密码");rn columnNames.add("状态");rn rn rowData= new Vector();rn //从数据库读取数据rn rn tryrn //1.加载驱动rn Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");rn ct=DriverManager.getConnection(url,user,passwd);rn rn ps=ct.prepareStatement("select * from personalinfo ");rn rs=ps.executeQuery();rn rn while(rs.next())rn Vector hang = new Vector();rn hang.add(rs.getString(1));rn hang.add(rs.getString(2));rn hang.add(rs.getString(3));rn hang.add(rs.getString(4));rn hang.add(rs.getString(5));rn rn rowData.add(hang);rn rn rn rn catch(Exception e)rn e.printStackTrace();rn finallyrn try rn if(rs!=null)rn rs.close();rn if(ps!=null)rn ps.close();rn if(ct!=null)rn ct.close();rn rn catch (Exception e) rn // TODO: handle <em>exception</em>rn e.printStackTrace();rn rn rn rn jt = new JTable( rowData,columnNames);rn rn jsp= new JScrollPane(jt);rn rn this.add(jsp);rn this.add(jp1,"North");rn this.add(jp2,"South");rn rn this.setVisible(true);rn this.setSize(500, 400);rn this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn rn rn rn
main" java.lang.NullPointerException">请教一个问题:Exception in thread "main" java.lang.NullPointerException
错误提示:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at awt.GridLayoutTest.init(GridLayoutTest.java:40)rn at awt.GridLayoutTest.(GridLayoutTest.java:28)rn at awt.GridLayoutTest.<em>main</em>(GridLayoutTest.java:70)rn程序如下:rnpackage awt;rnrnimport java.awt.Button;rnimport java.awt.Color;rnimport java.awt.Frame;rnimport java.awt.GridLayout;rnimport java.awt.Panel;rnimport java.awt.TextField;rnrnpublic class GridLayoutTest rn Frame frame = null;rn Panel pm = null;rn Panel pc = null;rn Panel ps = null;rn String[] s = "7","8","9","/",rn "sprt","4","5","6",rn "*","%","1","2",rn "3","-","1/x","0",rn "+/-",".","+","=";rn String[] m = "MC","MR","MS","M+";rn String[] c = "Backspace","CE","C";rnButton[] bs = new Button[s.length];rnButton[] bm = new Button[m.length];rnButton[] bc = new Button[c.length];rnTextField tf = new TextField("0.",150);rnrn public GridLayoutTest() rn init();rn rnrn private void init() rn frame = new Frame("计算器 v1.0");rn frame.setLayout(new GridLayout(4,5,3,3));rn for(int i=0;i
main"">新手求助,Exception in thread "main"
[code=java]package learn7;rnimport java.util.Arrays;rnpublic class 利用arraycopy方法复制数组 rn public static void <em>main</em>(String args[])rn char[]a='a','b','c','d','e','f',rn b='1','2','3','4','5','6';rn int [] c = 1,2,3,4,5,6,rn d=10,20,30,40,50,60;rn System.arraycopy(a,0,b,0,a.length);rn System.arraycopy(c,2,d,2,c.length);rn System.out.println("数组a的各个元素中的值:");rn System.out.println(Arrays.toString(a));rn System.out.println("数组b的各个元素中的值:");rn System.out.println(Arrays.toString(b));rn System.out.println("数组c的各个元素中的值");rn System.out.println(Arrays.toString(c));rn System.out.println("数组d的各个元素中的值");rn System.out.println(Arrays.toString(d));rn rnrn[/code]rn一下是编译运行结果,查看了很多遍。不知道错误在哪里rn[img=https://img-bbs.csdn.net/upload/201408/03/1407060256_772948.jpg][/img]rn
main" java.lang.UnsupportedClassVersionError...">基于Web的Kafka管理器工具之Kafka-manager启动时出现Exception in thread "main" java.lang.UnsupportedClassVersionError...
问题详情   我在Kafka-manager启动时出现 [hadoop@master kafka-manager-1.3.2.1]$ nohup bin/kafka-manager -Dconfig.file=/home/hadoop/app/kafka-manager-1.3.2.1/conf/application.conf -Dhtt...
main" java.lang.UnsupportedClassVersionError: org/apach">Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apach
1.启动tomcat报错的原因,可能是tomcat版本和JDK版本的兼容问题。 2.下载其他版本的tomcat试试。 我出错的时候是jdk1.7和tomcat9不兼容,将tomcat换成7版本的就可以啦! ...
Exception in thread "Thread-0" java.lang.NullPointerException
Exception in <em>thread</em> "Thread-0" java.lang.NullPointerException  分享| 2014-01-15 09:59ljh404 | 浏览 3082 次 package server; import java.io.IOException; import java.io.ObjectInputStream; import java.
main" java.lang.NullPointerException">4,spring注解获取sessionFactory为空问题Exception in thread "main" java.lang.NullPointerException
4,spring注解获取sessionFactory为空问题Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException  1,@Resource(name=&quot;sessionFactory&quot;) private SessionFactory sessionFactory; public  Session getSession(){ return...
main"java.lang.NoClassDefFoundError的错?">为什么执行JAVA程序时,会出现Exception in thread"main"java.lang.NoClassDefFoundError的错?
http://hi.baidu.com/%C7%B9%BB%A899/blog/item/9f485b66b37c5b24aa184c7b.html应该这样检查你的环境和你的操作: 1、你的文件名对吗?JAVA要求你的文件和你的类名严格对应的。比如 public class HelloWorld{ .....那么文件名一定只能是HelloWorld.java,看仔细了!2、你的程序中有<em>main</em>方法吗?参数什么的对吗?<em>main</em>方法的声明应该是这样子的:public static void <em>main</em>(Stri
VMware Workstation 8.0.4 .744019汉化包+注册码下载
VMware Workstation 8.0.4.744019汉化包 VMware Workstation 8.0.4.744019注册机 VMware Workstation 8.0.4.744019注册码 相关下载链接:[url=//download.csdn.net/download/o274274/4408677?utm_source=bbsseo]//download.csdn.net/download/o274274/4408677?utm_source=bbsseo[/url]
仿朋友网左右滑动菜单下载
仿朋友网左右滑动菜单 ViewGroup 带透明动画效果 相关下载链接:[url=//download.csdn.net/download/xjldzhuyang/4876095?utm_source=bbsseo]//download.csdn.net/download/xjldzhuyang/4876095?utm_source=bbsseo[/url]
lucene4.3工具类下载
lucene4.3增删改查的的一个工具类,对新手来说是一份不可多得的入门资料。 相关下载链接:[url=//download.csdn.net/download/u010454030/5951587?utm_source=bbsseo]//download.csdn.net/download/u010454030/5951587?utm_source=bbsseo[/url]
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池
我们是很有底线的