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

I need help calling a function...

I need to call a function inside a case, I tried to do it in some ways that I knew but it wont work. I want to call function "k" inside case 1 import java.io.BufferedReader; import java.io.InputStreamReader; import javax.swing.JOptionPane; import java.io.IOException; import java.io.InputStreamReader; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Kerido */ public class Proyecto { public static void comparar(String p1, String p2) { char[] a,a2; int i, ii,c=0; if(p1.length()==p2.length()){ //convierto a minuscula je p1.toLowerCase(); p2.toLowerCase(); a= p1.toCharArray(); a2=p2.toCharArray(); for( i=0;i<a.length;i++){ for(ii=0;ii<a2.length;ii++){ if(a2[ii]==a[i]){ c++; } }} if(c==p1.length()){ System.out.print("Las palabras son anagramas"); }else{ System.out.print("Las palabras no son anagramas"); } }else{System.out.print("Las palabras no son anagramas");} } public static void k(String[]args)throws IOException { InputStreamReader isr = new InputStreamReader (System.in); BufferedReader br = new BufferedReader (isr); int dia,mes,año,año1,semana,x,añobici,y,z,total,u,j; System.out.print("Dame El Dia: "); dia=Integer.parseInt(br.readLine()); System.out.print("Dame El Mes (En Numero): "); mes=Integer.parse

27th Apr 2018, 2:22 PM
Abraham Querido
Abraham Querido - avatar
1 Answer
0
I dont see a switch nor cases do you mean the if?
28th Apr 2018, 8:40 AM
TransHedgehog
TransHedgehog - avatar