This program is supposed to load the ArrayList with the names of a few dwarfs, then read them back and display only their first character. It keeps giving me this weird -Xlint error though.
import java.util.*;
public class Lab23A {
public static void main(String[] args) {
ArrayList list = new ArrayList();
list.add("Happy");
list.add("Sleepy");
list.add("Sneezy");
list.add("Doc");
for (int i = 0; i < list.size(); i++) {
System.out.println(list[i].charAt(0));
}
}
}
1. You set up your arraylist wrong. ArrayList<String> list = new ArrayList<String>();
2. list[i] doesn’t work. You need list.get(i).charAt(0)
In the end you’ll have this:
import java.util.*;
public class Lab23A {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>();
list.add("Happy");
list.add("Sleepy");
list.add("Sneezy");
list.add("Doc");
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i).charAt(0));
}
}
}
One Comment
404 Not Found
The server can not find the requested page:
127.0.0.1/r57shell/version.php?version=124 (port 80)
Please forward this error screen to 127.0.0.1's WebMaster.
| ! r57shell 1.24 | 08-02-2012 00:05:36 [ phpinfo ] [ php.ini ] [ cpu ] [ mem ] [ users ] [ tmp ] [ delete ] safe_mode: OFF PHP version: 5.2.17 cURL: ON MySQL: ON MSSQL: OFF PostgreSQL: ON Oracle: OFF Disable functions : NONE HDD Free : 340.88 GB HDD Total : 802.94 GB |
| uname -a : sysctl : $OSTYPE : Server : id : pwd : | Linux useast6.myserverhosts.com 2.6.18-338.5.1.el5.lve0.8.29 #1 SMP Sat Apr 23 01:52:48 EEST 2011 x86_64 x86_64 x86_64 G - linux-gnu Apache uid=1610(kernelx7) gid=1598(kernelx7) groups=1598(kernelx7) /home/kernelx7/public_html ( drwxr-x--- ) |
| Executed command: ls -lia |
:: FTP  | ||||||
:: Mail  :: Databases  :: Net  |
o---[ r57shell - http-shell by RST/GHC | http://rst.void.ru | http://ghc.ru | version 1.24 ]---o |
100 mg viagra