|
Hi i am a beginner user of Java and I want to make an weather Java program which use gui and the openweathermap api. Can anyone help me???
|
|
|
|
|
|
1. Learn how to write a problem
2. Learn about sockets. Probably need to learn about http and Rest also (but I didn't look at the API.)
3. Learn about UI
4. Create a program that uses the weather API. This uses 1, 2
5. Create a program that displays the results. This uses 1, 2, 3, 4.
|
|
|
|
|
You want to write a desktop or web application?
|
|
|
|
|
Hello,
I am learning hoe to program in Java and have come up with some code to practice what I have learned. I have created a program to enter password and confirm it and the only way I have found to do this is to exit the program and try it again. Please help
Scanner scanner3 = new Scanner(System.in);
String passwordConfirm = scanner3.nextLine();
if (passwordConfirm.equals(password) ) {
System.out.println("Your password has been confirmed");
}
else {
System.out.println("The passwords do not match, please try again below");
Scanner scanner5 = new Scanner(System.in);
String passConfirm = scanner5.nextLine();
if (passConfirm.equals(password) ) {
System.out.println("The passwords now match, thank you");
scanner5.close();
}
else {
System.out.println("The passwords still do not match, please reload the app to try again");
System.exit(0);
}
}
Your help is greatly appreciated! I have the same problem with confirming email but once I figure out password, I can do email myself.
|
|
|
|
|
A do-while loop is perffect for that:
String passwordConfirm;
do {
System.out.println("Please enter password:");
passwordConfirm = scanner3.nextLine();
} while (!passwordConfirm.equals(password));
System.out.println("Your password has been confirmed");
will keep asking for password until the correct one is provided.
If you want only a fixed number of tries, you may have to declare a counter variable, increased in the loop, and tested in the while statement.
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
Hi there,
Thanks for the help. But could I ask where I place that code and the code I should replace with it? I can't seem to figure out where to put it and the code to erase. Thanks!
|
|
|
|
|
It could replace the whole code block you have shown, except the first line which declares the scanner3 variable.
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
Thanks a million, it has worked beautifully also with username. Thank you!
|
|
|
|
|
You are welcome.
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
|
I Need Java Compiler source code
|
|
|
|
|
|
install the JDK. and search for src file
"C:\Program Files\Java\jdk1.8.0_131\src.zip"
unzip the file and enjoy !!
|
|
|
|
|
I'm doing hibernate web app from this tutorial: https://www.javatpoi...-with-hibernate and when I run url http://localhost:8181/register/ I get 404 error. Files are like in tutorial.
Project structure looks like this:
click
|
|
|
|
|
|
Good day.
May I know how to add an image into a combox in netbeans?
Can help, please...
|
|
|
|
|
|
any one has idea about how to get memory usage of remote server using java?
|
|
|
|
|
Yes, you need an application on the server that collects the information and sends it to the client.
|
|
|
|
|
|
do you have alternate idea?
|
|
|
|
|
Such as what? You cannot capture information from a remote system unless that system first collects the information, and either lets you request it, or it sends it to you in some way.
|
|
|
|
|
Might want to clarify that other answer however since it actually depends on what the server is running.
A 'server' with java often means a JEE container. And most if not all of them have management APIs that allows access to usage statistics. So something like Tomcat, JBoss, WebLogic, etc might already have a way to get it via a http server or an API.
|
|
|
|
|
JDK provide tool to monitor the remote java application's memory use, here is where you can find the tool:
after you download the JDK, it will located in the tools directory.
|
|
|
|