|
|
|
Classes in Java
Note: Here,
SOP = System.out.println("");
psvm()=public static void main(String args[])
|
No. |
Java Question |
Answer/Output |
Explanation |
|
1 |
public class Sample {
Sample(){}
} |
- |
This class can be referenced outside the package in which it is defined. The class
Sample cannot be instantiated and extended outside the package in which it is defined. |
|
2 |
class A{
{k=40;}
int k;
psvm(){
new A();
SOP(k);
} |
40 |
- |
|
|
Let The World Know How Knowledgeable You
Are By
sharing Your Knowledge With Others If you would like to share your knowledge
relating to Technology, you can send it to us at
dailyquestion@techstudentsworld.com. If it is good, it will be published in this
site along with your name or picture. |
Copyright © 2008, Techstudentsworld.com. All Rights
Reserved.
|
|
|