Questions tagged as 'java'

1
answer

Schedule Remains using Monte Carlo Method [closed]

I have little experience in Java and am trying to apply the Monte Carlo Method in Combinatorial Game Theory. I am trying to demonstrate the Method in the Undead Game where it will have to be solved using random steps. For the method to be effect...
asked by 13.04.2015 / 03:45
2
answers

Get first digits of a number in Java

How do I get part of an integer in Java? For example, I have a int a = 12345678 variable, and the user wants to receive only 4 digits.     
asked by 04.03.2015 / 23:55
2
answers

Memory competing and sharing between threads

I have the following code: class Objt { public List<t> list_t1; public List<t> list_t2; public Objt() { // faz inicializações } public void handleLists(List<t> list) { for(t e: l...
asked by 02.07.2016 / 21:49
2
answers

Calculate the smallest element in a list

Given a sequence of integers (read via Scanner ), determine the smallest of these values. My code: import java.util.Scanner; public class MenorValorSequencia { public static void main (String args []) { Scanner sc = new Sca...
asked by 16.07.2016 / 23:22
2
answers

MaskFormatter leaving empty space

In my project, I have an age field, where I want to receive a maximum of 3 numbers, so I did this: mskIdade = new MaskFormatter("###"); So far so good, but every time I type a number with less than 3 characters, mskIdade fills in the...
asked by 07.06.2016 / 22:33
2
answers

What is the error in this return exercise: Object orientation [closed]

public class Matematica { /* * @param um * @param dois * return o maior dos dois numeros * */ int maior(int um, int dois){ if( um > dois) { return um; }...
asked by 24.10.2014 / 13:56
2
answers

How to change the Text Color of a listView?

I'm trying to change the TEXT color of this listView I made following some examples on the internet, but the most I got was the comment from the line 39 txt.setTextColor (Color.GREEN); The problem is that this only changes the color when cl...
asked by 22.07.2014 / 22:59
1
answer

How to create a random 5-digit number starting from 1?

I have to create a bank account with some requirements, in the middle of them I need to have a constant number of 5 digits started from 00001. But putting "00001" at the time of display only displays 2, 3 onwards. my solution was to use the n...
asked by 14.02.2018 / 18:14
1
answer

Is it possible to create the main method in an abstract class?

Can I use the main method in an abstract class? An abstract class can not be instantiated, this I know. It can be referenced, yes. But can I use the main method in it? I'm not talking about "compile or not compile" I'm tal...
asked by 14.02.2018 / 18:04
3
answers

ListView with different layouts by lines, according to filtered value

I have a single table in the DB, which contains records with fields like: tipo, data, hora, cliente, historico According to the value of tipo , the cliente field is mandatory, ie vazio . To create a ListView...
asked by 30.01.2018 / 11:43