answersLogoWhite

0

Can you declare main class in-front of sealed class?

Updated: 8/18/2019
User Avatar

Wiki User

13y ago

Best Answer

If the question means to inherit from a sealed class (in-front-of), then the answer is NO. Sealed means end of the class hierarchy.

But if in front of means a base class, then the answer is YES, all class, regardless if it is sealed or not, must derive from a base (the default is Object)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you declare main class in-front of sealed class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you declared constructor as private?

If you declare the main method anything other than public, it will not run. If you declare main method as private, you would not be able to execute the class as a standalone java program. Any java class that needs to be executed as a standalone file needs to have a main method that is public, static and returns a void. Otherwise the Java compiler would not recognize the file as an executable standalone java file and would not allow you to run it.


What are the characteristics of a destructor?

The main characteristics of a Destructor are:Are inverse of ConstructorsCalled when objects are destroyedUsed to unlink an object resource / clean up resources used by an instance of a classAutomatically called when the instance of the class goes out of scopeDoesn't return any valueHas the same name as that of the class with a special character infront ( like ~ in C++ )


What is public class in java?

Generally to declare the class we use the public,abstract,final,strictfp and default modifiers. When ever we declare the class as public ,it mean public class A{} it is possible to access this class inside the same package and outside of the current package. ex: package name: pack This package contain the public class like package pack; public class A{} In this senario it is possible to access the in the same package "pack" like package pack; class Demo { public static void main(String args[]) { A a=new A(); } } And also it is posible to access the A class outside of the "pack" package like in anothe package like "pack1" package pack1; import pack.A; class Demo1 { public static void main(String args[]) { A a=new A(); } }


Can you declare main as final or not and why?

Yes you can. Try this: public class TestMain { /** * @param args */ public static final void main(String[] args) { System.out.println("Inside final mail method..."); } } It will print "Inside final mail method..." in the console.


Is it possible to call static methods with out creating object?

Yes, we can access all methods which declare with static means then we can access.. ex: class s{ static method() { System.out.println("Welcome"); } } class fun{ public static void main(String args[]) { method(); } }


The main reason for the formation of the US was to?

declare our independence from Britain


What is the main legislative branch?

To make laws and declare war


What is the legislatives main jobs?

To make laws and declare war


How do you invoke static methods?

if some method is static, then you can not call that method through the oobject of that class. but the name of the class. let us see a example: class Test { int a; int b; static void show() { System.out.println("we are in show"); } } class Main { public static void main(String args[]) { Test t=new Test(); t.show();\\thiss is an erroraneous code. because, the method "show()" is static. Test.show();\\this is correct } Arnas Sinha


Can an object be created from a main or non-main class?

please clarify the question. I have a feeling that the question is not asking what I am about to answer here. You may have a class named "main" in the program. I presume non-main means any class that is not main. Can an object be created from a class (named main or non-main)? It depends on how you design that class. Ususally yes.


What is the main point of each document in the declaration?

the main point was to declare freedom, and rights....------I think. :D :)


How do you call main class with in main class in java?

We can't call a class. We always call a method in java.