Results 1 to 6 of 6
Thread: wat is the problem in the code ?
- 08-14-2008, 05:30 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
- 08-14-2008, 05:51 PM #2
If you get errors, please copy and paste them here.
Don't expect anyone to do your work of compiling a pgm to see the errror messages.
- 08-14-2008, 06:54 PM #3
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
Code & error i faced --
class infoarr {
public char[]infoarr cunvert() {
char []c=new char[26];
for(int i=0;i<26;i++) {
c[i]=(char)('A'+i);
}
return c;
}
public static void main(String []a) {
infoarr in=new infoarr();
char[]s=in.cunvert();
for(char var:s) {
System.out.println(var);
}
}
error -->
jdk1.5.0_06/bin/infoarr.java [3:1] ';' expected
public char[]infoarr cunvert() {
^
1 error
Errors compiling infoarr.
Sorry Norm .. & thanks
- 08-14-2008, 08:38 PM #4
is there a black after the ]public char[]infoarr cunvert() {
- 08-14-2008, 10:16 PM #5
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
- 08-14-2008, 10:34 PM #6
The type declaration is a type, eg, a char array such as char[].
Don't put the variable name in it.
Java Code:class infoarr { public char[] cunvert() { char []c=new char[26]; for(int i=0;i<26;i++) { c[i]=(char)('A'+i); } return c; } public static void main(String[] args) { infoarr in = new infoarr(); char[] s = in.cunvert(); for(char var : s) { System.out.println(var); } } }
Similar Threads
-
What is the answer yo my problem with this code
By masaka in forum New To JavaReplies: 4Last Post: 03-26-2008, 06:33 AM -
Problem with code
By jvasilj1 in forum New To JavaReplies: 5Last Post: 02-02-2008, 08:34 AM -
Problem with code
By oregon in forum New To JavaReplies: 3Last Post: 08-05-2007, 05:57 PM -
Problem with zero in my code
By fernando in forum New To JavaReplies: 1Last Post: 08-05-2007, 06:39 AM -
Problem with my first code
By paul in forum New To JavaReplies: 2Last Post: 07-26-2007, 04:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks