|
Why a random value? Bank account numbers need to be unique so you should use a sequencing system so each generated number is greater than the previous.
|
|
|
|
|
this is just a class project..so I need get a Random number..random array..how can I?
|
|
|
|
|
|
i want generate some Random numbers..then put them in a array..this array is the bank account numbers for each user..now how can I define this in new class?
|
|
|
|
|
Decide how long the array needs to be and then generate a random value for each element in the array.
|
|
|
|
|
The array is Unknown.. may 1, may 2, may10!!!
|
|
|
|
|
Sorry, I have no idea what that is supposed to mean. Try showing the actual Java code that you are trying to use.
|
|
|
|
|
Is
javascript is overcoming by web assembly language ??
|
|
|
|
|
This forum is for technical issues with Java. Javascript is something totally different, and Google will most likely be the best source for your query.
|
|
|
|
|
|
hey I have code to write code in java and I need help can someone write this code for me ?
Write a program that will allow a user to play Aristotle's Puzzle. You must use a class Tile.java that represents each tile, the class must have two variables:
-boolean placed
-int value
You must use 2 arrays of Tiles:
the board
the available Tiles for placement
|
|
|
|
|
Short answer: No.
Longer answer: Your homework is given to test your knowledge, not to test your ability to get someone else to do your work. Think about the problem, write some notes about the properties that you need to create, the methods required to move the objects around etc. You may find that it is not as difficult as you think.
|
|
|
|
|
I don’t gonna do it I’m willing to pay someone to do it for me 
|
|
|
|
|
This is still the wrong place.
|
|
|
|
|
.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
import java.util.*;
import java.io.*;
class Codechef
{
public static void main(String[] args) throws Exception
{
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
int tc=Integer.parseInt(a.readLine());
Solution s = new Solution();
for(int i=0;i<tc;i++)
s.solve();
}
}
class Solution
{
boolean check(String str,List<String> list)
{
if(list.indexOf(str)!=-1)
return true;
return false;
}
void sum(List<Double> list)
{
Double temp = 0.0;
for (double i: list)
temp += i;
int result=temp.intValue();
System.out.println(result);
}
void solve() throws Exception
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(b.readLine());
String str;
double temp;
int result;
List<String> wordlist = new ArrayList<String>();
List<Double> timelist = new ArrayList<Double>();
for(int k=0;k<n;k++)
{
str = b.readLine();
if(check(str,wordlist))
{
int i= wordlist.indexOf(str);
temp = timelist.get(i);
temp = temp/2;
timelist.add(temp);
}
else
{
temp = 2;
for(int i=1;i<str.length();i++)
{
if(str.charAt(i)=='d' || str.charAt(i)=='f')
if(str.charAt(i-1)!='d' && str.charAt(i-1)!='f')
temp+=2;
else
temp+=4;
if(str.charAt(i)=='j' || str.charAt(i)=='k')
if(str.charAt(i-1)!='j' && str.charAt(i-1)!='k')
temp+=2;
else
temp+=4;
}
wordlist.add(str);
timelist.add(temp);
}
}
sum(timelist);
}
}
|
|
|
|
|
The error means that the string that was entered contains characters that cannot be converted to an integer. Check what is being input.
|
|
|
|
|
This error occurs when you input an argument to a function that has to convert the types of the data, such as in your case, from String to integer. To actually understand the problem do this simple thing, remove the throws Exception from the signature of the methods,
void solve() throws Exception This will lead you to the function that is most likely to throw the NumberFormatException (which is derived from Exception ), and it will lead you to the function call,
int n=Integer.parseInt(b.readLine()); The problem here is that the number that you are trying to input is not a valid number. I would rewrite the code in this way,
try {
int n = Integer.parseInt(b.readLine());
} catch (NumberFormatException exception) {
System.out.println("The input is invalid for this program to continue.");
} catch (Exception error) {
System.out.println("Unhandled error has occurred, information provided: " + error.getMessage());
} Remember, there is nothing that you can do to overcome this error, other than politely asking the user to enter the correct format of the number. This exception tells you that the number cannot be converted to that type—Integer. This means, that the number you are trying to input is correct, yet the NumberFormatException happens, the reason is that your number might be bigger than the MAX_VALUE for Integer type. Try using Long.parseLong() , or another type for the data that is overflowing.
Just for thought, read this as well, java - Integer.parseInt number format exception? - Stack Overflow
Number (Java Platform SE 7 )
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
hello,
If we call gc() method in our program on writing System.gc() and define finalize() in the same class . finalize() method exists in Object class so if i write the following code then i don't extend the Object class using extends keyword . So how the finalize() method is overridden in our class?? Or without using extends keyword how it it possible that the finalize() method is overridden??
public class fin {
public void finalize()
{
System.out.println("finalize called");
}
public static void main(String[] args) {
fin f1=new fin();
fin f2=new fin();
f1=null;
f2=null;
System.gc();
}
}
|
|
|
|
|
You should never call System.gc in your application. What exactly are you trying to achieve with this code?
|
|
|
|
|
I am trying to call finalize() method manually, but not able to understand without inheriting the Object class in my derived class how can i override the finalize () method???
|
|
|
|
|
As I asked before, what are you trying to achieve? The finalize and System.gc methods are used by the JVM and should not be called by user code, except in very exceptional circumstances. Google for "Java finalize" and you will understand why.
|
|
|
|
|
|
|
Greetings everyone.
I'm not one for bold entrances, but as I've signed up for this site I'd like some feedback from professionals and tinkerers from different areas of aptitude. This feedback would be regarding my program and the way I've gone about making it. I'm really open to all feedback at this point as I'm having difficulty getting people to try it.
So I graduated with my BS in IT focused on software development. Since nearly nobody wants an intern thats not attending college, and most places I've interviewed don't want a developer without experience I've dedicated nearly 300 hours this year to a program I've had my heart set on making. I call it eLuo Software. It tunes up Windows PC's. It also automates the process of removing Cortana and other annoying built-in Windows applications that certain privacy conscious individuals may want removed but can't do normally without scripting knowledge.
Anyway, I've developed this Windows application using Eclipse, GUI formulated using Window Builder (which doesn't seem compatible with Java SE 10). I'm considering switching to JavaFX as it seems more flexible and compatible with what I'm attempting. Trying not to delve too much into the details (unless requested by PM), I just want an honest opinion as to whether I'm wasting my time. This question is subjective, I understand. Do I enjoy making it? Yes. Does the everyday average user understand what it does or how it can help? No. I'm working on providing that information on my website. Google eLuo Software if you are curious. I have been a PC tech for several years and that's what inspired me to do this. I had some people at Toms Hardware say they would beta test for me but have yet to hear a response.
In summary what I'm looking for is any signs of interest in such a project, using Java to implement built-in Windows utilities to automate tasks for customization and PC Tune-ups (and hopefully one day, virus removals). Not just interest, but whether you think I'm doing it right. I also recognize C++ is very powerful and possibly what I should move towards if I am going to be working with finer details of individual systems.
Anyway, thanks for reading. If you find anything worth discussing from this rant filled with ambiguous questions, please do.
|
|
|
|