Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

java installation procedure..

 
archana keerti
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
hey guys,
i am new to java....
would you please help me how to compile and execute the java codes.
which java installation package should i install?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to JavaRanch
Have a look at the getting started part of the Java Tutorials. Download JDK 6 update 11. Don't use the JRE (it hasn't got a compiler) and don't use NetBeans at this stage.

It tells you in great detail what to do: the bit which most commonly causes trouble is setting the PATH. Please ask again if you have any problems.
 
archana keerti
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi ,
please anyone could help me...i have a problem in the compilation of the below given program.

public class puzz
{
public static void main(String args[])
{
dog[] d=new dog[6];
int x=0;
int y=1;
int result=0;

while(x<6)
{
dog[x]=new dog[];
d[x].v=y;
y=y*10;
x=X+1;
}
x=6;
while(x>0)
{
x=x-1;
result=result+d[x].do(x);
}
System.out.println("result is"+result)

}

}


class dog
{
int v;
public int do(int f)
{
if(v>100)
{
return v*f;

}
else
{
return v*(5-f);
}
}
}


the required output for the program is 543345.


when i compile i get some error messages like,illegal start of type,<identifier>expected, ; expected.....
i couldn't find where i am wrong.....
 
Henry Wong
author
Marshal
Pie
Posts: 21001
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
    Bookmark Topic Watch Topic
  • New Topic