Category "java"

Why does the PrintWriter class (and other writers) require a call to flush after writing?

I have noticed that some I/O Classes in Java (and a lot others, like the BufferedWriter and FileWriter), require a call to flush() after writing. (With the exce

Using If in RecyclerView, doesnt show all the item of the list

I am trying create a RecycleView for my chat application and to align the sent and arrived messages to the left and right. I used an if state to check if that i

Custom IdentifierGenerator returns null

So, I want to customize the ID for a "FriendID" with IdentifierGenerator, and I want to make it as simple as possible first just to make sure it works. Been wat

Spring one Controller for nested entities

I'm working on a school project and I'm not sure how to implement this case. I would like to implement it as best practice. Right now I have 3 entities -> St

Is there a way to make a button to loop user inputs for a number of times before terminating?

I have been turning the popular guessing game into an app using Java in Android Studio. I want it so that a user can make up to five trials before the answer is

How to delete table records on cascade without the program freezing?

this is my delete button method, it takes the college name as a primary key and deletes it so the whole record gets deleted. However, it can't be deleted becaus

TableView Not Being Populated [duplicate]

Does anyone have any idea why the table is not getting populated with the products? MainController class: //imports Public class MainControll

How can I spoof prop values that don't belong to android.os.Build?

With the following segment of code I'm able to spoof certain build.prop parameters such as brand, manufactuer, device, product and model: data class DeviceEntri

Get seconds between next day with time

I am trying to get the Duration until the next time, depending on a Day of Week in Java. I want to be able to schedule a Java task for the next day in a list, a

I ned a while loop statment that makes the calculations loop and ask again

im not too sure how you add a loop statement to this. I want it to be a while loop that makes it do that the calculations repeat after finishing. I've tried but

Accessing specific elements in Arraylist of Objects

Really confused on how to access just the age of a specific student where all the information of students have been stored in a textfile. I am reading the textf

/Main.java:17: error: non-static variable this cannot be referenced from a static context ^ 1 error [duplicate]

In this simple code can anyone explain me what's wrong ? public class Main { public class UserValidator { public void validateName(String

In Java how to synchronize cache read and write operations

I am working on implementing a simple cache using ArrayList in my application. I would like to synchronize cache update operations, while updating the cache I s

What is the way around this error "java.lang.RuntimeException: PowerMock internal error: Should never throw exception at this level"

java.lang.RuntimeException: PowerMock internal error: Should never throw exception at this level at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44R

Java File Naming [duplicate]

I'm new to Java. I want to know why Java doesn't give an error and lets the compiler compile it when I write as class class-name without publi

iText 7 - How to send to an API and receive/render on the other end

I am trying to send a PDF that will be created in memory from one API to another API which will then render it in an HTML page. Info about my technologies: Spri

E-commerce background business process Java and Spring

I need create a ecommerce api using Java and Spring. But how create a background process, for example: After place order, i need send confirmation e-mail, wait

What's the best approach to verify integrity for crypted files on AWS EFS?

Hello i'm working for the first time with AWS EFS, and for security reasons in my organization data will be stored encrypted, but not with AWS standard EFS encr

Mac terminal not valid context

I'm a new Mac user. I'm receiving this error every time I open my terminal and I'm not sure what its about. I was hoping someone can help me with this issue. Th

ANTLR4 error recovery issues for class bodies

I've found a strange issue regarding error recovery in ANTLR4. If I take the grammar example from the ANTLR book grammar simple; prog: classDef+ ; // match o