Questions tagged as 'java'

1
answer

Is it possible to throw an error that triggers others?

Here's an example: public class Teste { public static void main(String[] args) { func1(); } public static void func1() { try { func2(); } catch (Exception e) {...
asked by 21.10.2016 / 21:46
2
answers

Decimal places when using Println in Java

I have the following problem when I print this function System.out.println("Area do Tetraedro = " + c1.getArea()); The value of it is very large, eg:    Area of Tetraedo = 389.71143170299734 How to leave it with two decimal places?...
asked by 19.05.2014 / 13:52
2
answers

How do I get the values of a date in the format "dd / MM / yyyy hh: mm" and compare with system date after setting it in this same format?

I wanted to make a comparison between the date contained in the hour1 object with the system date, how can I do it? import java.text.SimpleDateFormat; import java.util.Date; public class MainTarefas { public static void main(String[] a...
asked by 18.06.2014 / 00:37
1
answer

Regular Expression in Java

I'm programming in Java and need to filter a String from a regex using the matches() method. I can accept letters (a-z) or numbers (0-9), where this number can have 1 or n digits. I'm using the following regex: [A-Z|a-z|\d{n} ] ....
asked by 07.06.2014 / 03:01
1
answer

Attempt to update registry ID not allowed with JPA and EclipseLink

How do I allow a record ID to be updated with JPA and EclipseLink? The following exception is thrown when I try to update the ID:    Caused by: Exception [EclipseLink-7251] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.ecli...
asked by 29.05.2014 / 19:07
1
answer

JDBC - does not connect to Mysql database

In java I created a project where I use the drive mysql-connector-java-5.1.40-bin.jar In this project I created a class with a form to register course and in mysql I created a database called sistema with a table called curso...
asked by 02.11.2016 / 17:49
1
answer

Is it possible to copy files without using stream buffer?

In my application, I have a class that periodically backs up a pretty small (less than 1MB) file, but I'm doing some testing and after reading this answer , it seems to me that it has been suggested that you can make copies without having to us...
asked by 05.12.2016 / 11:58
1
answer

Doubt when picking map value

Hello. When I print the values and keys of Map , it comes from the bottom up. I wanted to know how I can get it from top to bottom. import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class ClassDebug {...
asked by 10.01.2017 / 14:03
1
answer

What is the difference between Type-safe and Null-safe?

I'm writing an article about Kotlin, and I came across these guys if anyone can help me. What is the difference between Type-safe and Null-safe?     
asked by 24.10.2017 / 19:30
1
answer

Recursive binary tree and sum of leaves

Friends I'm having trouble resolving this exercise, and I do not know how else to do it. I got to implement the tree with recursion, but I could not leave the Knot empty and some sheets with number, according to the exercise. Then I need to add...
asked by 29.10.2017 / 22:22