Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

2 votes
0 answers
1k views

How to hide database credentials in Spring Boot application?

SOLVED Solution: Using Jasypt. You can click here for more information how to set up. There is just one thing to mention. For me, it didn't work as if I configure the application.properties as they ...
EDOYou's user avatar
  • 35
0 votes
2 answers
329 views

Does this break the abstraction barrier?

If a method returns a private field which is type casted, does this consider as breaking the abstraction barrier? e.g. private Object thing; public getThing() { return (String) thing; }
Zenith's user avatar
  • 23
0 votes
1 answer
254 views

How to organize Java-Project without packages?

I am working on a java-library and due to information-hiding, I was forced to move all my java-files into a single package in order to mark some of them as package private. Is there any way to some ...
λExpression's user avatar
1 vote
1 answer
470 views

How to hide a button or textView while implementing screen recording

Suppose I'm having a screen in which there are many buttons and textViews and if someone who comes through this screen while using the application tries to take a Screenshot or Screen Record, some ...
Harish Dadi 's user avatar
1 vote
0 answers
51 views

Hiding type parameters that are implementation details

I have a class that has some type parameters that are not implementation details, and some that are. What's the best way to deal with type parameters that should not be part of the public API without ...
Mike Samuel's user avatar
-1 votes
1 answer
146 views

Can I enforce visibility using java.security?

This follows on from this question, which is about Groovy (a superset/modernisation of Java), where there is, seemingly, essentially no information-hiding and no encapsulation whatsoever. But in Java ...
mike rodent's user avatar
  • 15.2k
0 votes
1 answer
76 views

How do compilers perform information hiding and encapsulation?

When I create a Java class definition, I can use private, public, protected and other keywords to control how the members and methods are accessed: public class Bowel{ private Movement privatePoop =...
Anwar Hahj Jefferson-George's user avatar
-1 votes
4 answers
174 views

How to avoid code duplication maintaining information hiding trough polymorphism [closed]

I wrote the following two classes (implementing a state pattern): Price: public abstract class Price { public abstract double getAmount(int rentalDays); public abstract int getPriceCode();...
sworwitz's user avatar
0 votes
0 answers
485 views

my movie code in java

I'm only a beginner and I am having some struggles. this is for a uni assignment, I've had to make a a movie database and have to have four different classes. (i.e movie, playlist, movie database, ...
C.Bachen's user avatar
4 votes
2 answers
1k views

Breaking encapsulation and information hiding in Java

Consider the following snippet. package breakoop; public class BreakOOP { public static class A{ private int a; } public static class B extends A{ public int f(){ ...
Igor Ševo's user avatar
  • 5,475
0 votes
0 answers
35 views

Why is abstract private methods are not allowed in enums in java? [duplicate]

Shouldn't it perfectly legal to write private abstract methods in enums? Is there a reason to forbid it that I cannot see? A toy code example that does not compile is below; Lets assume I do not want ...
user2259824's user avatar
3 votes
4 answers
2k views

Reducing the visibility of a static method

I know that a child cannot reduce the visibility of a non-static method and I understand why it is so. I've read however that "static method can be hidden through its redeclaration". I however do not ...
infoholic_anonymous's user avatar
1 vote
4 answers
11k views

hiding your password in java class file for a test case

I am trying to write a selenium test case which will be put on company jenkins server where all the employee will have access to every java files I create. public static void main(String[] args) { ...
user3792255's user avatar
2 votes
3 answers
206 views

What's the default behaviour of subclass method without using super?

Is there a possibility to have some default behaviour defined for a method in a subclass, without having to call super? E.g: Suppose we want to set a boolean value in the superclass and you want to ...
Steven De Bock's user avatar
4 votes
2 answers
23k views

Practical example Encapsulation vs Information Hiding vs Abstraction vs Data Hiding in Java

I know there are lots of post regarding this question which has theoretical explanation with real time examples.These OOPs terms are very simple but more confusing for beginners like me. But I am ...
Prashant Shilimkar's user avatar

15 30 50 per page