Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 14th, 2007, 12:09 AM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Exclamation String compare

Hi All,

This gives me a null pointer exception:

   System.out.println("\nThere are " + polyInstance.signChanges(tempCoefsArray,  noCoefs) + " positive real roots in the equation you entered\n");

......other non important code here.....

public int signChanges(String tempCoefsArray[], int noCoefs)
	{

		int signChanges=0;           
     
			for(int i=0; i<=tempCoefsArray.length-2; i++)
			{
                               if(tempCoefsArray[i].charAt(0) != tempCoefsArray[i+1].charAt(0))//null ptr here
				 {

					 signChanges++;
				 }
				
			}
		return signChanges;
	}

Last edited by paulchwd; Apr 14th, 2007 at 12:20 AM.
paulchwd is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Function Parameters grimpirate PHP 10 Mar 14th, 2007 6:55 PM
C# corruption!!! Kilo C++ 32 May 21st, 2006 8:44 PM
Array issues :( Alo Tsum Java 10 Nov 26th, 2005 5:45 PM
A standards question, optional inputs into Methods Arla C# 4 Apr 27th, 2005 10:38 PM
replace space with ' * ' TecBrain C++ 15 Apr 13th, 2005 12:32 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:58 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC