Results 1 to 4 of 4
Thread: Array Is not subtracting
- 02-07-2018, 06:56 PM #1
Senior Member
- Join Date
- Dec 2016
- Posts
- 103
- Rep Power
- 0
Array Is not subtracting
Java Code:ResultSet dt=dep_time.executeQuery(); ArrayList<String> dp_dt=new ArrayList<String>(); while(dt.next()){ dp_dt.add(dt.getString("dep_time")); } ResultSet at=arr_time.executeQuery(); ArrayList<String> al_dt=new ArrayList<String>(); while(at.next()){ al_dt.add(at.getString("arr_time")); } int d=0; int a=0; String time=null; String tm[]=dp_dt.toArray(new String[dp_dt.size()]); String tm1[]=al_dt.toArray(new String[al_dt.size()]); String tm2[]=new String[tm.length]; for(int j=0;j<tm.length;j++){ tm2[j]=tm[j]-tm1[j]; //Its showing a bad operand error.. }
- 02-07-2018, 06:59 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Array Is not subtracting
You are trying to subtract two Strings.
You can't do that.
You might need to explain what it is you are trying to do, and what values those Strings contain.
I think I can guess, but it would be best for you to explain it.Please do not ask for code as refusal often offends.
** This space for rent **
- 02-07-2018, 07:06 PM #3
Senior Member
- Join Date
- Dec 2016
- Posts
- 103
- Rep Power
- 0
Re: Array Is not subtracting
I am fetching two diferent train time from a table and store into two array list
After that i want to find time taken
So i store into a array and then try to subtract to find time taken...
Thanks
- 02-07-2018, 09:39 PM #4
Similar Threads
-
Adding/Subtracting a int
By Alkor in forum New To JavaReplies: 10Last Post: 03-09-2012, 08:32 AM -
getting a date value from db and subtracting it in jsp
By dayalan in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 03-14-2011, 10:05 AM -
Subtracting 2d Arrays
By Spyderpig in forum New To JavaReplies: 9Last Post: 03-11-2011, 06:12 AM -
Subtracting Strings
By ravian in forum New To JavaReplies: 7Last Post: 10-08-2009, 07:26 PM -
Subtracting Strings
By lazygun247 in forum New To JavaReplies: 6Last Post: 03-29-2009, 11:05 PM
Bookmarks