How can I access the value of a private attribute in a class, from a class in another package, without using an access method, such as a getter?
class Person{
private String name = "Someone";
}
Why would anyone do this?
One of the r...
Let's say I have the following String S = "00-44 48 5555 8361" entry and I need to return this 3-by-3 split string separated by "-" as follows:
Output: 004-448-555-583-61
The number of characters may vary. Below the following sc...
Read the four values corresponding to the axes x and y of any two points in the plane p1(x1,y1) and p2(x2,y2) and calculate the distance between them, showing 4 decimal places after the comma, according to the formula...
See below a java code to save a SQL command return in PostgreSQL. The command is EXPLAIN ANALYZE.
The problem is that by saving this to the database, it loses the line breaks. Someone would know how to help me solve this, that is, so that when d...
How do I transform the following into a Lambda code?
The idea is to multiply maxScore by i so that with each interaction it raises the number, only for the first 5 results.
for(int i=0;i<5;i++){
list.get(i).se...
I'm trying to implement a generic DAO with CDI. Apparently I'm doing it right, however I'm getting the following error:
can not be cast to java.lang.reflect.ParameterizedType
This error is pointing me to this line of my Repository clas...
I'm doing a project using Spring boot in IntelliJ + maven. Following and reading tutorials. I did the step by step but when giving Run the Tom Cat is not demonstrated, activated. I am not using any other server.
Below is the code Main + Pom + Co...
import java.util.Scanner;
public class Tp1 {
public static void main (String [] args){
final int qtdAlunos = 5;
String [] nomes = new String[qtdAlunos];
double[] av1 = new double[qtdAlunos];
double[] av2 = new double[qt...