Questions tagged as 'java'

1
answer

Difference between type inheritance and implementation inheritance

My teacher passed a tutorial on Object-oriented Data Structure with Java and in the handbook there is an excerpt (without deepening) that reads as follows:    "Interface promotes inheritance type and non-inheritance of   Implementation; "...
asked by 06.05.2018 / 03:12
3
answers

Refactor the code using the factory pattern without using the if-elseif condition

I have the following Factory . In it I instantiate a class responsible for parsing the file in question. In order to instantiate this parser, it is first checked under the conditions if that parser is the correct one to perform the process...
asked by 08.05.2018 / 02:34
1
answer

Two GIT Projects

If I have a project already being done in git and at any given moment I need to join with another project but keep the history of commit how?     
asked by 21.09.2017 / 21:18
2
answers

Filter query with java android sqlite

public ArrayList<Contato> filtrar(String filtro) { ArrayList<Contato> contatoArray = new ArrayList<>(); //Consulta que traz todos dados de todas colunas Cursor cursor = database.query(BaseDAO.TABELA_AGENDA, BaseDAO....
asked by 18.09.2017 / 15:54
1
answer

Find String in ArrayList

ArrayList<String> posicoes = new ArrayList<String>(); posicoes.add("Ricardo;01051509912;gmail"); posicoes.add("Renato;123456789123;hotmail"); posicoes.add("Rodrigo;09873923121;yahoo"); I have a ArrayList whose name is po...
asked by 30.08.2017 / 05:23
2
answers

What's the difference in using ModelAndView and ResponseEntity?

I came across these two classes, I found their function well the same. What are the differences between them and when is the time to use a specific one?     
asked by 17.01.2018 / 18:28
1
answer

Turn "26 / Feb / 2013" into an OffsetDateTime (2013-02-26 00:00:00)

I gave an example of the month of February, but it could be Jan, Mar, etc ... I get a String with the month "abbreviated" (only the date as in the title), I want to convert this to a OffsetDateTime being ZoneOffset = UTC and the default t...
asked by 26.01.2018 / 16:32
1
answer

Difference in casting in Java

What's the difference between the 2 codes below? 1st int x = 10; float i = (float) x; 2nd int x = 10; float i = Float.parseFloat(x);     
asked by 26.01.2018 / 16:48
1
answer

JPA annotation @OneToMany or ManytoOne?

I have the Report Class public class Report{ private String nome; @ManyToOne @JoinColumn( name = "idpai", referencedColumnName = "id" ) private List<Report> subReports getters e setters... } My question is how t...
asked by 16.01.2018 / 13:08
1
answer

How to make a method return a string in Java

I want to create a program that reads the name and age of a person and compares the ages and finally shows the name of the oldest person. My rationale was to compare which is the largest and return the index of the position of the array . But t...
asked by 08.09.2017 / 20:46