answersLogoWhite

0

Why constructor rather than classes in java?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

Constructor is not an alternative to class. In Java, you create classes; the classes contain methods - including the constructor, which can be viewed as a special method. If you want to have a constructor, you need a class that surrounds it, so it's not one or the other.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why constructor rather than classes in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you overload the constructor in java true or false?

Yes, you can have more than one constructor with a different set of parameters.


Can a .java file contain more than one java classes?

Yes, it can. However, there can only be one public class per .java file, as public classes must have the same name as the source file.


Can you have more than 1 constructor in a class?

Yes. At least in Java, that's possible, as long as the constructors have a different number, or different types of, parameters.


Importance of computer packages in construction?

A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality. 1. A package provides a unique namespace for the types it contains. 2. Classes in the same package can access each other's members.


What is packaged programs?

A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality. 1. A package provides a unique namespace for the types it contains. 2. Classes in the same package can access each other's members.


How many packages available in java?

A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality.· A package provides a unique namespace for the types it contains.· Classes in the same package can access each other's members.package is a container in which similar classes are grouped together.package avoid the redundance of classes. it also provide security to hide the code only by importing the packege which contains the required class.


Why are constructors dynamic rather than static by default?

Because the JVM decides are run time which constructor to invoke depending on the parameters passed to it


How does java programming language handle graphics?

Java Graphics APIs - AWT and Swing - provide a huge set of reusable GUI components, such as button, text field, label, choice, panel and frame for building GUI applications. You can simply reuse these classes rather than re-invent the wheels. I shall start with the AWT classes before moving into Swing to give you a complete picture. I have to stress that AWT component classes are now obsoleted by Swing's counterparts.


Can always create objects of all types of classes?

Of course, JAVA programming has a stricter syntax format than C++


Is it possible to have more than one public class in the same file?

No. There can be multiple java classes in the same .java file, but the name of the file must match the name of the public class in the file.


Who has the best Microsoft Excel classes?

Rather than Microsoft Excel classes, I'd just take an ICT course at my local college, as they'd offer more option rather than just those valid skills.


What is java EE 5?

Java is a programming language which comes in many varieties. Some of the common ones are Micro Edition (ME), Standard Edition (SE), and Enterprise Edition (EE). Java EE includes more classes than the other versions, including classes and packages designed to make developing client-server (and other internet-based communication) projects a faster process. Java EE 5 just means the fifth major version of the Java EE suite.