-1
In a "use java head" book exercise, it asks to declare 3 string arrays, but when I put the code in the ide it gives an error of incompatible string types to String[] someone knows why???
package exercicios;
/**
*
* @author DANIEL
*/
public class Exercicios {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String[] lista1 = ("24/7", "Varias Camadas","B-to-B","Todos ganham","front-end","baseado na web","Difundido");
String[] lista2 = ("habilitado","adesivo","valor agregado","orientado","central","distribuido","agrupado");
String[] lista3 = ("processo","ponto máximo","solução","arquitetura","habilitação no núcleo","estrátegia");
int n1 = lista1.length;
int n2 = lista2.length;
int n3 = lista3.length;
int rand1 = (int) (Math.random() * lista1);
}
}
In the book the literal arrays is with parentheses or keys?
– Maniero
Yes,
String
is a thing,String[]
is another. The first is just a type, the second is the way to declare an array that supports only the String type.– user28595