Linked Questions

-2 votes
1 answer
4k views

I am fairly new to Java, and whenever we have written programs in school, we put each class in a separate java file, but I do not remember why this was (if there was even a reason). Right now I am ...
Szmagpie's user avatar
  • 216
1 vote
4 answers
2k views

I am a Java learner and while I was studying, I realized a book uses 2 or 3 classes in a same file. But when I actually followed the book's codes I was not able to run it. for example, Class Point {...
0x01's user avatar
  • 39
-2 votes
3 answers
181 views

Possible Duplicate: Java: Multiple class declarations in one file Recently I was going through a java class in which I have discovered that it was a java class with the named A but after that ...
user1614879's user avatar
1 vote
1 answer
108 views

In the code of a legacy application I just came across a class file that contained inner classes, but those inner classes where not defined within the class body but after the closing bracket of the ...
Markus Mitterauer's user avatar
0 votes
1 answer
153 views

Does it creates individual .class files when it gets compiled? Is it something right to do?
Fuheybady's user avatar
-1 votes
1 answer
83 views

in this code the classwhat we called class "filepanel" in below code.it is neither static inner nor inner then what we called it?i want to check for such type of classes from java code using AST ...
rosedoli's user avatar
17 votes
9 answers
16k views

Still coming from C++ I find it cumbersome to create many small helper classes and objects. Mostly because I have to have one file per class. I basically have a class like this: public class ...
Espen's user avatar
  • 3,727
17 votes
6 answers
22k views

In a single .Java file, is it possible to have a public interface and a public class (which implements the interface) I'm new to Java coding and it is written on most places on the net that a .java ...
Linda Peters's user avatar
20 votes
3 answers
18k views

We can always have multiple classes inside a .java file. Considering encapsulation and that each class consists of multiple lines of code it always made sense to have 1 class (don't talk about nested ...
Panagiotis Bougioukos's user avatar
20 votes
4 answers
7k views

It seems to me that non-public top-level classes and static nested classes essentially perform the same tasks when creating a helper class. A.java public class A { public static main (String[] ...
Stephen's user avatar
  • 532
8 votes
4 answers
18k views

I'm new to Java (have experience with C#), this is what I want to do: public final class MyClass { public class MyRelatedClass { ... } } public class OtherRandomClass { public ...
Mervin's user avatar
  • 1,113
2 votes
3 answers
4k views

I'm just starting with Java, although I already have some experience with OOP in PHP In this example, I have a simple class called Person, with fields such as name, age, and sex. I was wondering what ...
Levy Barbosa's user avatar
0 votes
3 answers
3k views

Example1Exception and Example1Method belong together in the same file. It would not make sense to put them in separate files. public class Example1 { public class Example1Exception extends ...
cja's user avatar
  • 10.2k
0 votes
1 answer
22k views

I am not sure why I get continuing told the error of java22 in my code. I searched other person's question like around. like here Compiler error: "class, interface, or enum expected" But I ...
dukej's user avatar
  • 37
0 votes
2 answers
7k views

is there a way to declare 2 classes on the same .java file using Eclipse - also how the compiler will distinguish the .class for each declare class. example public class ThisTest { public static ...
Sinan's user avatar
  • 457

15 30 50 per page