Java Programming Forums
621 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
1d ago
public class MainClassCutsom {
public static void main(String[] args) throws CustomExceptionClass{
Scanner in = new Scanner(System.in);
System.out.println("Enter the player name");
String playerName = in.nextLine();
System.out.println("Enter the player age");
Integer age = Integer.parseInt(in.nextLine());
CustomExceptionClass c = new CustomExceptionClass(playerName, age);
try {
if(c.getAge() >= 19) {
c.displayDetails();
} else {
throw new CustomExceptionClass("InvalidAgeRangeException");
}
} catch(Exception e) {
System.out.println("CustomException:"+e.getMessage ());
}
in.close();
}
}
I ..read more
Java Programming Forums
1d ago
The longest common subsequence of strings s1, s2 is the longest string s such that s is a subsequence of both s1 and s2, i.e. we can get s by starting at some point in si, reading through, perhaps skipping some letters, and then stopping at some point.
Suppose now our alphabet contains a special ‘anchor’ character * which binds ‘more strongly’ than ordinary letters: concretely, when reading through each si to find s we are not allowed to skip any *s (although there may be *s outside the section of si we read). So for example, suppose that s1 = A ∗ BCD∗ and s2 = B ∗ CAD. We would not be allowe ..read more
Java Programming Forums
5d ago
public class Main {
public static void main(String[] args) {
A a =null;
try{
a = new A(1);
}catch (IOException e) {
System.out.println(a == null);
}
}
}
class A {
private int v;
public A(int val) throws IOException {
v= val;
throw new IOException("123");
}
}
as far as i know
the process of new a object has 3 steps:
1. allocate memory
2. execute construct function
3. assign to reference
due to instruction reordering, the process may be changed to 1->3->2 rather than 1->2->3.
so will the result of the code above always be true?
sorry for my english ..read more
Java Programming Forums
1w ago
Free connections, adventures await you
Verified Maidens
Unsurpassed Сasual Dating ..read more
Java Programming Forums
1w ago
okay so this is my server class
Code :
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
public class Server {
private ServerSocket server;
private static List<Accomodation> allAccommodations = new ArrayList<>();
public static void main(String[] args) {
new Server().openServer();
}
public synchronized static void addAccommodationToServer(Accomodation newAccommodation) {
allAccommodations.add(newAccommodation);
}
public static List<Accomodation ..read more
Java Programming Forums
1w ago
Sorry if i look really stupid, but i started with java today. I tried to write a simple "Hello World" and i did it, but when i go to terminal and type
javac HellWorld.java it gives me this:
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 27, in <module>
from CommandNotFound.util import crash_guard
ModuleNotFoundError: No module named 'CommandNotFound'
I would really appreciate if you help me.
(I use Linux Mint MATE 21.3 ..read more
Java Programming Forums
1w ago
Object oriented programming. So my problem would be using their server. ImageBam.com. On some one else's web page.
All I got to do is place a class file on NetBeans and this just might work.
https://www.kauai.gov/Government/Council/Councilmembers-2022-2024 ..read more
Java Programming Forums
1w ago
Garbage collection (GC) is a fundamental aspect of memory management in Node.js applications. However, inefficient garbage collection can lead to performance issues, causing application slowdowns and potentially impacting user experience. To ensure optimal performance and diagnose memory problems, it’s essential to study garbage collection traces. In this blog post, we’ll explore various methods for capturing garbage collection traces from Node.js applications.
Options to capture Garbage Collection traces from Node.js applications
There are 3 options to capture Garbage Collection traces fro ..read more
Java Programming Forums
1w ago
Những tÆ¡ mÃ*ng bị lan truyá»�n am tÆ°á»�ng, Ä‘iện tá»* trong những năm trở lại đây hở có những bÆ°á»›c chuyển trui, vạc triển chóng vánh vÃ* đóng vai trò quan yếu trong suốt cuá»™c sống hiện. Tạo vì váº*y đặng sá»± thÃ*nh đánh nhÆ° hiện giá»� lÃ* cáº*y sá»± phối hợp ăn ý mức các mót bị, phÆ°Æ¡ng thức váº*n hÃ*nh, trong suốt đấy có chuẩn tÃ*n hiệu. NgÃ*y bữa nay, chúng ta sẽ nhằm cữ hiểu phăng má»™t trong những chuẩn má»±c lan truyá»�n tin tưởng.# còn nháº*n để lÃ*m vÃ* cao cÅ©ng nhÆ° khá trổi ..read more
Java Programming Forums
1w ago
Những sầu bị lan truyá»�n thông, Ä‘iện tá»* trong những năm tang lại đây vẫn giÃ*u những bÆ°á»›c chuyển trui, phát triển chóng vánh vÃ* tắt vai trò quan trá»�ng trong cá sống hiện nay. Tạo bởi váº*y nổi sá»± thÃ*nh tiến đánh nhÆ° hiện lÃ* nhá»� sá»± kết hợp ăn rÆ¡ hạng danh thiếp đói bị, phÆ°Æ¡ng thức váº*n hÃ*nh, trong đấy lắm chuẩn má»±c tÃ*n tiệm. NgÃ*y hôm nay, chúng ta sẽ được ngần hiểu béng má»™t trong những chuẩn truyá»�n tin tưởng.# Ä‘Æ°Æ¡ng dìm đặng công giá cao cÅ©ng nhÆ° khá trá»™i ..read more