I need an help on String ... string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need an help on String ... string

22nd Sep 2019, 10:12 AM
Luigi Dagostino
Luigi Dagostino - avatar
7 Answers
0
here: help String ... string
22nd Sep 2019, 10:29 AM
voja
voja - avatar
+ 3
Keywords like for,return and if should be lower case
22nd Sep 2019, 11:05 AM
D_Stark
D_Stark - avatar
0
I have a function public int defineStocks(String . . . stocks){ ...//body }
22nd Sep 2019, 10:30 AM
Luigi Dagostino
Luigi Dagostino - avatar
0
I do for(String d : stocks) but i receive a nullpointerexception when i try to do stock[j] = d
22nd Sep 2019, 10:31 AM
Luigi Dagostino
Luigi Dagostino - avatar
0
Public int defineStocks(String ... stocks){ Int rightTransiction =0; For (String d : stocks){ For(int j =0; j<i; j++){/*i Is a public variabile in public classe*/ If(stock[j]==d) Return rightTransiction; } stock[i]=d;//here i have the nullpointerexception i++; rightTransition++; } Return rightTransition; }
22nd Sep 2019, 10:43 AM
Luigi Dagostino
Luigi Dagostino - avatar
0
I know they are lowercase on the Pc i writer it on the phone
22nd Sep 2019, 11:06 AM
Luigi Dagostino
Luigi Dagostino - avatar
0
Did you initialize stock? If you have something like this: static String[] stock; you will get NullPointerException :
22nd Sep 2019, 11:13 AM
voja
voja - avatar