Skip to content
Advertisement

Tag: class

Does a class without methods have a special name?

What is a class without methods called? I’m trying to understand and learn about classes, so i have the following class “Variables” that doesn’t have methods, only fields, like the field “Server” in a folder called “utilities”: then this class is called from a method in another class located in another folder or package this way: is this (the without

The object-oriented approach to a many-to-many relationship

I’m battling at the moment in trying to understand how to approach this issue in an object-oriented way. With a many-to-many relationship such as Students-Subjects, where each student gets a mark for a certain subject, assuming the following: I want to be able to display all the marks for a given student. I want to display all the marks from

Can a object be private and public?

Can a reference to an object be private in class while other object can have a public reference to the same class(post script: new to java+ a simple example please). I read somewhere that this prob is regarding aliasing? Sorry my title may not make sense! Answer Objects aren’t private or public. Fields can be private or public. Fields can

How can we use .class on primitive types?

When we say it prints class java.lang.Integer which makes sense because java.lang.Integer is a class. So we can have a corresponding Class object. But when I do it prints int which I felt is kind of ambiguous as .class returns an object of type Class and int is not a class (but a primitive type). What is the motive behind

What does “Could not find or load main class” mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class … What does this mean, what causes it, and how should you fix it? Answer The java <class-name> command syntax First of all, you need to understand the correct way to launch a program

Advertisement