
Java Programming Forums
1,000 FOLLOWERS
Welcome to the Java Programming Forums, a community of Java programmers from all around the World. Join now to solve all your Java problems, learn to code Java, share your wisdom and help others expand their knowledge.
Java Programming Forums
8h ago
I want to learn of how building java applications and so much more, but I have just started is there any videos or could someone teach me how I would be able to build that ..read more
Java Programming Forums
21h ago
Hi,
We have updated time using Clock and Offset methods in Java. I want my Java Application which has Quartz scheduler to fire messages at a specific time to run at the updated Time ultimately we want to believe the Quartz Scheduler believe that the actual time is the updated time
For Example
if the current time was 11:00 we want our Application and Quartz to believe that the current time is 09:00 .We have used Clock Offset methods for changing the time to 09:00 but what I need is to Application believes that current time is to 09:00
Can we Achieve this using Java?
Thanks In Advance!
Regards ..read more
Java Programming Forums
4d ago
In this series of simulating and troubleshooting performance problems in Kotlin, let’s discuss how to make threads go into BLOCKED state. A thread will enter into a BLOCKED state when it couldn’t acquire a lock on an object because another thread already holds the lock on the same object and doesn’t release it.
Video: To see the visual walk-through of this post, click below:
https://youtu.be/czhLzcmZ_ME
Kotlin blocked thread Program
Here is a sample program, which would make threads go into BLOCKED state.
Code :
package com.buggyapp
class BlockedApp {
fun start() {
pr ..read more
Java Programming Forums
4d ago
Hello everyone!
I want to replace a line if it contains more than 70 characters and replace it with a simple sentence.
My code looks like this but it doesn't work.
Code Java:
String doc_notes_in_gross_text=(String) tmp.get(4);
string doc_notes= "See EBP notes
if(doc_notes_in_gross_text.length()>=70) {
String doc_notes_in_gross_text= doc_notes;
How do I proceed ..read more
Java Programming Forums
6d ago
hello everyone, can someone help me with my problem? Our java teacher tell us to do this " Create a program that does not store the whole input in the memory. " and this is the program i have. But i don't know what to change to not store the input in the memory. Thank you all for you futur awnser.
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int actual_number = -1, sum=0, counter=0;
while (actual_number!=0)
{
System.out.println("Enter a number:");
actual_number=sc.nextInt();
sc.nex ..read more
Java Programming Forums
1w ago
Hi dear community :)
I've made this simple JavaFX application, it only has one class myclass.MyClass, and it has a view.fxml resource.
I am using IntelliJ on a Mac M1, and it compiles and runs fine.
The problem is to export it.
In an ideal world, I would like to have a proper executable (a file you can double-click on) for Mac Apple Silicon, for Mac Intel, for Windows, and for Linux.
But for now I would be happy just to have a way to distribute it, at least to another Mac. For example an executable jar would work great, then I can ask people to install their own JRE.
I've been all over the ..read more
Java Programming Forums
1w ago
I have a class "circle" which extends from class "shapes". When I try to call the "display" method using the keyword "super"
return (super.display() + " Color: " + color);
the value for size gets lost. I think it calls this constructor, shapes()
How do I get the program to call this constructor, shapes(int size)
Here's my code:
class shapes {
private int size;
shapes(){}
shapes(int size){
this.size = size;
}
public String display() {
return ("Size: " + size);
}
}
class circle extends shapes {
private String color;
circle(String color){
this.color = color;
}
public String display ..read more
Java Programming Forums
1w ago
First it asks the user to input a number to select a certain type of fish. Each case takes user input and does something like this for whichever fish they selected: I_a fish1 = new fishtype();
I_a is the name of the constructor so that should already be defined in the other files. But just in general, say someone is using a constructor with the same variable for every selection in a switch statement, what do you do when it says the variable is already defined? It does not say that for the first choice, only every other one
Thanks ..read more
Java Programming Forums
1w ago
Java virtual thread is a new feature available from JDK 19. It has potential to improve the application’s availability, throughput and code quality on top of reducing memory consumption. If you are interested in learning more about Java virtual thread, here is a quick introduction to it.
Video: To see the visual walk-through of this post, click below:
https://youtu.be/zaslILyCKok
In this post, let’s learn the pitfalls one should avoid when switching from Java platform threads to virtual threads:
1. Avoid synchronized blocks/methods
2. Avoid Thread pools to limit resource access
3. Reduce ..read more