Code is showing error that cannot find symbol String [] z | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code is showing error that cannot find symbol String [] z

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner (System.in); String n = sc.nextLine(); int a = n.length(); String [] z = {A,a,B,b,C,c,D,d,E,e,F,f,g,G,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,v,V,w,W,x,X,Y,y,Z,z}; int q =z.length; String c =""; String t=""; for(int i=a-1;i>=0;--i){ char b = n.charAt(i); c = c + b ; } for(int j=0;j=a-1;++j){ for(int i=0;i<=q-1;++i){ if (c.charAt(j)==z[i]){ t = t + c.charAt(j); } } } System.out.print(t); } }

16th May 2020, 6:20 AM
Shivam Rawal
5 Answers
+ 4
You didnt used (☞゚ヮ゚)☞ " " for example:- String[] z={"A","a","B","c"..........}; thats why error is cannot find symbol.
16th May 2020, 6:45 AM
Abhay Kalsi
Abhay Kalsi - avatar
+ 1
You are comparing charecter with strings. So it not works.. Make charecter array.. char z[] = {'A', 'a', 'B',.........} ;
16th May 2020, 12:17 PM
Jayakrishna 🇮🇳
+ 1
Tysm
17th May 2020, 6:44 AM
Shivam Rawal
0
Ya tysm
16th May 2020, 6:46 AM
Shivam Rawal
0
Also if condition is not working pls tell why
16th May 2020, 7:03 AM
Shivam Rawal