Questions tagged as 'java'

2
answers

Questions about the Spring XML file?

I'm developing an application that uses JAVA SE + SPRING. I have some questions regarding XML: Where do I create the file xml of Spring ? What is the name I give to arquivo xml ? The XML would be the settings for the S...
asked by 01.09.2016 / 21:21
1
answer

Sort array alphabetically and show only first name of each item

I am totally a layman in Java, I wanted help in completing an exercise. The statement is this:    "write a program that receives an array with the name   complete of 10 people and present an array with only the first name   of each person...
asked by 28.08.2016 / 19:47
2
answers

How to find a pattern to keep the same data modeling between a JSON object, a POJO, and JPA?

To make it easier for me to understand my question, follow the example below: A POJO: public class Person { private String name; private String location; } String JSON: String json = {name:"Jose", location:"Eslovenia"}; Se...
asked by 26.07.2016 / 22:36
2
answers

Save a foreign key entity with Hibernate 4

I'm starting to study Hibernate and would like to know how to save a foreign key entity. Here is an example of two entities: Student: @Entity(name = "aluno") public class Aluno extends Pessoa{ @Column(nullable=false) private String...
asked by 23.05.2016 / 01:54
2
answers

Double wrapper initialization with int does not compile

I want to understand why this boot does not work: (1): Double d = 10; // Não funciona I understand that Double is a wrapper , the compiler should convert this line to: (2): Double d = Double.valueOf(10); // Funciona...
asked by 29.05.2016 / 17:35
3
answers

Java - Palindrome string inversion

I'm trying to do an exercise where I need to invert a word, phrase or number and check if it's palindrome. For words and numbers, it is already working, but for phrases it gives errors depending on what it is, for example the phrase "help me get...
asked by 09.02.2016 / 15:37
1
answer

Why can not I view Javac?

Colleagues. I downloaded sdk jre1.8.0_73, but I can not see javac inside the bin folder. I have already created the environment variable and still nothing. Is this version no longer the javac?     
asked by 08.02.2016 / 13:46
1
answer

Percentage in Java

Business rule : A program that receives the code of a user, the qtd in KWh that it consumes and the type of it that can be 3: each type multiplies the cost of energy consumed as they are defined the constants at the beginning of the program, al...
asked by 10.11.2016 / 01:27
1
answer

Modify value of the String object passed as parameter

I need to change the value of a variable dynamically by passing it as a parameter by an auxiliary method. I always used the parameter values from right to left. You can change the variable from left to right: Fields in my class: private Str...
asked by 20.11.2016 / 14:03
1
answer

Problem with sieve of Eratosthenes - JAVA

My teacher passed the following class for implementing the Eratosthenes sieve, but gave very vague instructions on how we should do it, although it made it very clear that we should only work on the methods getPrimes() and findPrimes()...
asked by 09.11.2016 / 15:20