Results 1 to 2 of 2
- 04-04-2008, 12:21 AM #1
Member
- Join Date
- Apr 2008
- Posts
- 1
- Rep Power
- 0
why we use public access modifier?
I have a slight problem with my code below. I created a file and named it ClosedCurve.java and wrote all code into the file.
My code below wont be compiled. unless I add an access modifier public. and I do not understand why i need to do that.
PHP Code:package classs.and.objects; public interface ClosedCurve { double computeArea(); } class Triangle implements ClosedCurve { double computeArea() // I need to change to public double computeArea() { return 0.0; } }
- 04-04-2008, 07:04 AM #2
Hi ..
Because in interface methods are public abstract ....by default.
and in your class if u are not providing public access modifiers then default access modifier is used and it is not possible to decree the access modifiers from public to default in java.
if still not clear the i will let u know more.
Sanjeev
Similar Threads
-
public declaration ('undeclaring')
By Jadellll in forum New To JavaReplies: 2Last Post: 03-17-2008, 08:50 PM -
Public Holidays (Australia)
By oranjeBoven in forum Advanced JavaReplies: 0Last Post: 02-13-2008, 08:14 AM -
Public class variable
By Java Tip in forum Java TipReplies: 0Last Post: 12-03-2007, 09:58 AM -
public method
By dirtycash in forum New To JavaReplies: 4Last Post: 11-21-2007, 07:29 PM -
Help with access a database using Microsoft Access
By cachi in forum JDBCReplies: 1Last Post: 08-07-2007, 07:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks