Questions tagged as 'java'

2
answers

How to exchange / exchange the value of two variables

I'm having trouble writing this exercise in the Java Language, using the Eclipse IDE:    Read two values for the variables A and B, change the values so that the variable A has the value of the variable B and that the variable B has the value...
asked by 09.03.2018 / 15:19
3
answers

How to insert string from res / string into array String [] {};

I'm trying to put my Strings in an array to use on the adapter and I can not. I'm doing this: String cores[] = String[]{getString(R.string.cor1), getString(R.string.cor1)}; But it sure is not the right way. How to do?     
asked by 20.08.2014 / 13:21
2
answers

Create a set method for different variables

I want to create a setter for a Character object, where it will modify the attributes String name , int intellect , int strength and int stamina , but what is the best method for if you do that? public class C...
asked by 12.08.2014 / 02:16
1
answer

Send an ArrayList of objects to an Activity

How to send an ArrayList of objects to an activity on Android? ex: I have an ArrayList of Books objects, I want when I click the button this array of objects are passed to another activity ..     
asked by 30.07.2014 / 23:52
3
answers

Problem getting random integer values in array

Eclipse does not point to any errors in the code, but does not execute. package gerarOrganizar; import java.util.Random; public class GerarOrganizar { public static void main(String[] args) { int i=0; int[]ranF =null;...
asked by 08.10.2014 / 19:10
3
answers

Java time counting seconds in real time

I want to show the system time and the seconds counting in real time in Java.     
asked by 08.01.2015 / 16:16
2
answers

Check string value

I wanted you to check if the value entered is vegetarian, and if it is, print on the user's screen is vegetarian as the code follows, however when I type vegetarians or anything else it alerts you that it is not. import java.util.Scanner; publ...
asked by 22.03.2015 / 21:04
3
answers

consuming JSON

I'm having trouble getting a JSON file from the internet. I have some data in this link link and I want to get it to use in my application, the link returns something like: { "Categorias":[ { "nome":"Black", des...
asked by 16.12.2014 / 18:42
2
answers

Put method return before a "finally" block

Considering: try { System.out.println("Parte 1"); return false; } finally { System.out.println("Parte 2"); } What will be the output and what happens underneath the cloths so that the output goes out like this?     
asked by 29.11.2014 / 01:35
3
answers

Remove first word from String

I have stringBuffer with a phrase inside. I need to remove the first word from the string. Making the second become first and the number of words to be x-1.     
asked by 28.01.2015 / 22:13