which declartation are allow in the // // public class Orange{} i know package qwt.two ,import java.awt.* can put on the // i'm not sure class Apple() can put on the // or not?
package qwt.two import java.awt.* class Apple() {} public class Orange{ //do something } is it correct for the above code? please explain.
Micheal Zhao
Greenhorn
Joined: Aug 28, 2000
Posts: 4
posted
0
I think so . just try to compile and see the result.
Originally posted by Joe S: which declartation are allow in the // // public class Orange{} i know package qwt.two ,import java.awt.* can put on the // i'm not sure class Apple() can put on the // or not?
package qwt.two import java.awt.* class Apple() {} public class Orange{ //do something } is it correct for the above code? please explain.
deekasha gunwant
Ranch Hand
Joined: May 06, 2000
Posts: 396
posted
0
Hi, Yes It's okay to have Apple class at //. because there is no restriction on the no. of classes that u can write in a file except that only one of them can be public. In this case Orange class is public but Apple is not.so Apple reside along with Orange. had Apple also been public then this would have given a compilation error. regards deekasha