[Solved] why is it showing error . Like I thought the third loop will end and it will enter the first loop but didn’t else showed an exception

just replace the condition of the there loops with 26. Now the exception index out of bound will not occur public class SuggestingAppNames { public static void main(String[] args) { System.out.println(“the possible outcomes are”); String a = “A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z”; String d[] = a.split(“,”); String b = “A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z”; String e[] = b.split(“,”); String c = “A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z”; String … Read more

[Solved] I need something like a multi dimensional array but using a for loop [closed]

Just use a regular for loop to iterate over all arrays at once: String[] item ={“[1]hotdog”, “[2]eggpie”,”[3]menudo”,”[4]pizza”,”[5]lumpia”}; int[] cost = {5, 10, 15, 20, 25}; int[] selling = {10,15,20,25,30,}; int[] qty = {2,4,6,8,10}; for (int i = 0; i < item.length; i++) { System.out.println(” ” +item[i]+”\t”+cost[i]+”\t\t”+selling[i]+”\t\t”+qty[i]); } I would recommend putting all of these fields … Read more

[Solved] Keep track of string matches to create a new ID

I would probably consider doing this another way… Have an empty hashmap<String sub, int multiplier> Read in the name Generate the subname Fetch from or create subname in hashmap If new, set multiplier to 1 If exists, increment multiplier Return String.format(ā€œ%s%3dā€, subname, multiplier x 5).toUpperCase() I would give you code but writing the above was … Read more

[Solved] When I compile this why doesn’t it print anything? [closed]

You never call your method “forloop()”, that’s the reason why there’s nothing printed. NewbieJavaDeveloper’s answer is a good one. But if you want to pactice “method and return”, here is another answer: import java.util.Scanner;//import scanner so user can input class arrays { public static void main(String[] param) { String[] animals = arrays(); forloop(animals); System.exit(0); } … Read more

[Solved] C for loop not working

I tried to run that and my outputs for r1 and r2 are qwdaweqwe asdas–sd (two spaces) and basically it is what the code should be doing. But if I get your intention right, you want to work with those empty strings. Then you should be feeding your function with different numbers, because array indexing … Read more

[Solved] How to add two int array values together?

This kinda works. I can think of a couple of cases where something like this would break, like if the arrays were like {9,9,9} and {9,9,9}, result would be {9,9,8} instead of {1,9,9,8}. It’s a minor fix that is being left as an activity to the reader. public static void main(String []args){ int[] number1 = … Read more

[Solved] merge list of nested list to a single list which has lakhs of data python [duplicate]

from itertools import chain l = [[‘password’, ‘_rev’, ‘_id’, ‘username’], [‘password’, ‘_rev’, ‘_id’, ‘username’, ‘name’], [‘password’, ‘_rev’, ‘_id’, ‘username’],[‘password’, ‘_rev’, ‘_id’, ‘username’,’country’]] list(set(chain(*l))) Output – [‘username’, ‘_rev’, ‘_id’, ‘name’, ‘password’, ‘country’] solved merge list of nested list to a single list which has lakhs of data python [duplicate]

[Solved] For/if/else loop has unexpected identifier [closed]

Just about every angle-bracket language I know follows the following conventions: The condition of an if statement normally goes in parenthesis You shouldn’t have a curly brace at the end of turnCard(‘hit5′}; You shouldn’t have a ; at the end of your if-statements(or your for statement) Some languages allow you to use single-quotes like that … Read more