duvida no exemplo abaixo não existe algum cast que resolve esse erro:
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList <String> arr= new ArrayList<String>();
arr.add("B");
arr.add("A");
List<Object> list = new ArrayList<Object>();
list.add("A");
list=arr;
System.out.println(list);
}
gostaria de saber se o que fiz está certo tenho que colocar as palvras abaixo
nas lacunas e a saida tem que ser a seguinte:
Dog
is
man's
friend
Ah,apples all over
as palvras são :
"a"
5
4
6
:
split
substr
String
"\d"
"\\d"
"d"
String[]
--
public static void main(String[] args) {
// TODO Auto-generated method stub
Pattern p = Pattern.compile(_________________);
_____________ words =p.________("Dog5is6man's78friend");
for(______ word ____words){
System.out.println(word);
}
String s1 = new String("Aaaaah,apples all over");
String [] splits = s1.split(_____, _______);
for (int i = 0; i < splits.length; i++) {
System.out.println(splits[i]);
}
}
}
--- o que fiz mas não sei se está certo
public static void main(String[] args) {
// TODO Auto-generated method stub
Pattern p = Pattern.compile("\\d");
String[] words =p.split("Dog5is6man's78friend");
for(String word :words){
System.out.println(word);
}
String s1 = new String("Aaaaah,apples all over");
String [] splits = s1.split("a", 5);
for (int i = 0; i < splits.length; i++) {
System.out.println(splits[i]);
}
}
}
não entendi essa pergunta :pois as alterantivas a,b,c são corretas …
mas está perguntando a qual não compila ???
Which of the following statements will compile without errors and print "5 + 6 = 11" when inserted at line 6 independently ?
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x=5;
int y=6;
int sum = x+y;
//line 6
}
Select 1 option
a)System.out.format("%d + %d = %d\n", x,y,sum);
b)System.out.printf("%d + %d = %d\n", x,y,sum);
c)System.out.println(x+" + "+y+" = "+sum);
d) All of the above