Results 1 to 2 of 2
Thread: I have a problem with final
- 11-20-2007, 12:12 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 50
- Rep Power
- 0
I have a problem with final
Hi friends,
I am new to this forum.
I am learning java now.
I have a problem in defining a constant using final .please help me.
when i compiled this,i got an error like thisJava Code:class Testconst { public static void main(String args[]) { static final double PI = 3.141592653589793; System.out.println("pi="+pi); //........ //....... } }
illegal start of expression
static final double PI = 3.141592653589793;
Is there any mistake in my code ?
please tell me.
Thank u very much.
- 11-20-2007, 12:25 AM #2
Try eitherJava Code:C:\jexp>javac test.java exptest.java:5: illegal start of expression static final double PI = 3.141592653589793; ^ 1 error
orJava Code:public class Test { static final double PI = 3.141592653589793; public static void main(String[] args) { System.out.println("PI = " + PI); } }
Java Code:public class Test { public static void main(String[] args) { final double PI = 3.141592653589793; System.out.println("PI = " + PI); } }
Similar Threads
-
UJO Framework 0.73.final
By Java Tip in forum Java SoftwareReplies: 0Last Post: 04-15-2008, 06:53 PM -
UJO Framework 0.72.final
By JavaBean in forum Java SoftwareReplies: 0Last Post: 03-17-2008, 08:28 PM -
problem with final
By sireesha in forum New To JavaReplies: 1Last Post: 11-20-2007, 01:31 AM -
PLz i really need help on this final thing
By jason27131 in forum New To JavaReplies: 2Last Post: 08-03-2007, 02:31 AM -
Poi 3.0-final
By levent in forum Java SoftwareReplies: 0Last Post: 05-22-2007, 07:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks