Questions tagged as 'java'

4
answers

Why an if can be redundant?

Using a method that returns a boolean the system would determine whether a number is positive or negative. So I did it this way: public boolean isPositive(float num) { boolean positive; if (num >= 0) { positive = tru...
asked by 19.04.2016 / 21:02
5
answers

Return null in method?

I have a method in which the function of it is, read a file and store the value written to the file in a variable and return the variable, here's the method: public String addItemCreative(File f){ String line = null; try{ Buffe...
asked by 24.11.2015 / 11:57
1
answer

how to open the android camera and take the photo and upload the photo to the server?

I have a problem with the application it opens the camera but it does not upload aguem can see where I'm going wrong follow the code public class MainActivity extends Activity{ //chamar quando a atividade é a primeira criada @Overrid...
asked by 13.10.2016 / 21:42
1
answer

How to fill an ontology from Java?

I'm working with ontologies, and I have an OWL file where my ontology is already defined, classes, object properties, and so on. I use Protegé 4.1 to fill these policies by creating the instances of each class. But I'm trying to create these ins...
asked by 20.08.2015 / 17:52
2
answers

Doubt on List that does not return the result

I have this method in Java, which queries the database and returns me a list of students. The method is querying the DB but does not return the data correctly ... public static List<alunos> teste() throws SQLException { String sq...
asked by 15.11.2016 / 01:44
4
answers

Removing a specific space in a string

I'm having trouble implementing replace in String in Android Studio. I need to remove some white space in String . Real examples: 8 hrs 2 mins 1 day 2 mins I need the text to look like this: 8hrs 2mins...
asked by 16.12.2015 / 12:21
3
answers

What is JBOSS?

I'm reading a book on Distributed Applications and he occasionally references JBoss. I would like to know what it consists of and what is its usefulness?     
asked by 10.12.2015 / 15:53
4
answers

How to search within this object vector?

How would I search for a record within my object? The program is a contact book, and I wanted it to do the search by the name that I type in a JPane and return the contact's contact information. Here is the commented code. package ExemploDe...
asked by 09.03.2016 / 08:25
3
answers

How to shuffle characters from a String in Java at random?

I am developing a password generator program. Here you can set the percentage of numbers, letters and special characters you want to have in your password, as well as the size of your password. Later I concatenate the numbers, letters and symbol...
asked by 12.11.2015 / 20:43
2
answers

How to use "BigInteger" type to solve this problem?

I am solving a solution based on the story involving the chessboard. Here's a piece of history:    "Then Sessa asked for her payment in wheat grain as follows:   A grain of wheat for the first house on the board, two for the second,   four by...
asked by 18.09.2015 / 15:18