Questions tagged as 'java'

1
answer

Method with foreach only returns false

I have a method that will check if the debt equals zero ( divida == "0" ). If it returns true , otherwise it returns false . Code: for(String divida : dividas){ return divida == "0"; System.out.println(...
asked by 26.07.2015 / 20:05
4
answers

How to get value from a String before a special character

Hello, good morning. I'm having a little question, how can I get the value of a String before some special character. For example, Clinica Antonio S / S. I would just take the Clinica Antonio S, what comes after the bar does not need to be picke...
asked by 20.04.2015 / 16:51
3
answers

Use Double in compareTo method

I have a question. I have several methods of comparison, however, one of the attributes used to make the comparison is double. There is an error:    Can not invoke compareTo (double) on the primitive type double I tried converting t...
asked by 26.02.2016 / 18:19
3
answers

Repeated letter counter in java

I made a method for counting repeated letters that are stored and ordered alphabetically within a list. The method is counting right but the bug is at the time of printing, it printa the letter and the amount of times that appears in the sentenc...
asked by 18.09.2017 / 02:36
2
answers

Component eg: MasterDetail does not work on dynamic pages

I'm developing a web application that aims to work like Facebook. During browsing the page is not reloaded, loading via AJAX only the central content. I'm using PrimeFaces 4.0 and PrimeFaces Extension 1.2.1 But when my page (from the centr...
asked by 01.02.2014 / 03:07
2
answers

Why is it necessary to close the file?

Why is this line required in Java? fout.close(); Context: LinkedList values = new LinkedList(classe.getTurma().values()); if (!values.isEmpty()) { FileOutputStream fout = null; String FILE = "TURMA"; try {...
asked by 30.11.2017 / 17:59
4
answers

Read Internal File name [closed]

I need to read the name of the files contained within a package, for example, read the name file01.txt , as in the image below: So I can scroll through the arquivos package without having to name a file for reading.     
asked by 19.10.2016 / 19:31
3
answers

How to create a static method using Kotlin?

In JAVA when we want to create a static method, we use static . See: public static String getDragonGlass(){ return String.valueOf("All the dragon glasses."); } And in Kotlin , what better way to represent a static method?     
asked by 08.08.2017 / 15:27
2
answers

Creating an array from two

I have the situation where I need to build a arrayC[] in Java from a arrayA[4] and a arrayB[7] , where arrayC[] must display arrayA[4] and then arrayB[7] : For example: arrayA[4] = {A0; A1; A2; A3}; a...
asked by 06.06.2018 / 19:04
2
answers

What is Java's sort?

Every programmer knows that a list of arrays is printed neatly, but in the middle of the path has sort() . The result of this impression was: Abacaxi Banana Laranja Manga I imagined it would print this way: Banana Laranja...
asked by 14.10.2018 / 13:54