Click here to Skip to main content
15,891,713 members
Home / Discussions / Java
   

Java

 
GeneralRe: Can we have Scala added to the list? Pin
dusty_dex26-Feb-13 9:42
dusty_dex26-Feb-13 9:42 
Questionchoise of framework for end of study Pin
simontifo25-Feb-13 2:33
simontifo25-Feb-13 2:33 
AnswerRe: choise of framework for end of study Pin
Prasad Khandekar2-May-13 20:15
professionalPrasad Khandekar2-May-13 20:15 
Questioncompiler Pin
Olfat Ameen 23-Feb-13 17:56
Olfat Ameen 23-Feb-13 17:56 
AnswerRe: compiler Pin
Richard MacCutchan23-Feb-13 21:18
mveRichard MacCutchan23-Feb-13 21:18 
QuestionJava Pin
thevivek.pro21-Feb-13 19:42
thevivek.pro21-Feb-13 19:42 
AnswerRe: Java Pin
Marco Bertschi21-Feb-13 22:08
protectorMarco Bertschi21-Feb-13 22:08 
Questionproblem with looping Pin
Member 982953620-Feb-13 22:20
Member 982953620-Feb-13 22:20 
Hello everyone! I'm currently having a problem with my program it doesn't loop properly please help me with it. The code is below. Thanks in advance!

Java
import java.util.Scanner;
import javax.swing.JOptionPane;
import javax.swing.*;
    public class Wewe{
        public static void main(String[]args){
            Scanner inp = new Scanner(System.in);
            boolean tryAgain;
            do{
            System.out.print("\nInput username: ");
            String user = inp.nextLine();
            System.out.print("\nInput password: ");
            String pass = inp.nextLine();
        if(user.equals("admin") && pass.equals("admin")){
                System.out.print("Success!");
                tryAgain = true;
            }
            if(user!="admin" && pass!="admin"){
                JOptionPane.showMessageDialog(null, "Try again! Invalid username or password!","Error Logging-In", JOptionPane.ERROR_MESSAGE);
            tryAgain = false;
        }
    }while(tryAgain = true);
            }
        }


What I want to happen is that once the user entered wrong username or password the program will then loop. But if the user entered the correct username or password, it wont loop asking the user for the correct one.
AnswerRe: problem with looping Pin
Richard MacCutchan20-Feb-13 22:56
mveRichard MacCutchan20-Feb-13 22:56 
AnswerRe: problem with looping Pin
ameymh21-Feb-13 18:59
ameymh21-Feb-13 18:59 
GeneralRe: problem with looping Pin
Richard MacCutchan21-Feb-13 22:35
mveRichard MacCutchan21-Feb-13 22:35 
SuggestionRe: problem with looping Pin
SENTHILKANTH26-Feb-13 1:44
SENTHILKANTH26-Feb-13 1:44 
QuestionCalendar Recommendations Pin
FyreWyrm16-Feb-13 5:45
FyreWyrm16-Feb-13 5:45 
AnswerRe: Calendar Recommendations Pin
Prasad Khandekar2-May-13 20:20
professionalPrasad Khandekar2-May-13 20:20 
QuestionJava convert Image to unsigned char [][] Pin
chor_savorn12-Feb-13 20:44
chor_savorn12-Feb-13 20:44 
AnswerRe: Java convert Image to unsigned char [][] Pin
Richard MacCutchan12-Feb-13 22:26
mveRichard MacCutchan12-Feb-13 22:26 
GeneralRe: Java convert Image to unsigned char [][] Pin
chor_savorn3-Mar-13 23:07
chor_savorn3-Mar-13 23:07 
GeneralRe: Java convert Image to unsigned char [][] Pin
Richard MacCutchan3-Mar-13 23:18
mveRichard MacCutchan3-Mar-13 23:18 
GeneralRe: Java convert Image to unsigned char [][] Pin
chor_savorn4-Mar-13 14:36
chor_savorn4-Mar-13 14:36 
GeneralRe: Java convert Image to unsigned char [][] Pin
Richard MacCutchan4-Mar-13 22:52
mveRichard MacCutchan4-Mar-13 22:52 
GeneralRe: Java convert Image to unsigned char [][] Pin
chor_savorn5-Mar-13 22:09
chor_savorn5-Mar-13 22:09 
GeneralRe: Java convert Image to unsigned char [][] Pin
Richard MacCutchan5-Mar-13 22:21
mveRichard MacCutchan5-Mar-13 22:21 
GeneralRe: Java convert Image to unsigned char [][] Pin
chor_savorn5-Mar-13 22:40
chor_savorn5-Mar-13 22:40 
GeneralRe: Java convert Image to unsigned char [][] Pin
Richard MacCutchan5-Mar-13 23:35
mveRichard MacCutchan5-Mar-13 23:35 
QuestionMS Doc in Java Pin
Thirunavukkarasu Dhanushkodi11-Feb-13 4:55
Thirunavukkarasu Dhanushkodi11-Feb-13 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.