Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error encounter: error while writing test: test.class (Access is denied)

807601Apr 23 2008 — edited Apr 23 2008
Hi i have encounter this problem when i compile my java file
This is my test.java
public class test 
	{
		  private String s1= "Happy", s2= "Happy2", s3, s4;
		  private String i,toy,castille;
		  public test()
		  {
			System.out.println("Inside Bath");
		  }
		
		  public String toString() 
		  {
    			if(s4 == null) // Delayed initialization:
      		s4 = "Joy";
    			return
      		"s1 = " + s1 + "\n" +
      		"s2 = " + s2 + "\n" +
      		"s3 = " + s3 + "\n" +
      		"s4 = " + s4 + "\n" +
      		"i = " + i + "\n" +
      		"toy = " + toy + "\n" +
      		"castille = " + castille;
  		  }	
	


		public static void main(String[] args) 
		{
			test b = new test();
    			System.out.println(b);
  		}
	}
Error i received was:
C:\>javac test.java
test.java:1: error while writing test: test.class (Access is denied)
public class test
^
1 error

What is the problem with the code?
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2008
Added on Apr 23 2008
3 comments
1,936 views