I want the user to quit the while loop from pressing the Q key. But it isnt working

import java.util.Scanner;


public class CurrencyConversion{
	
	public static void main(String[] args){
		// declare and initialize variables
		double dollars = 0;
		//double euro = 0;
		// declare scanner
		Scanner scan = new Scanner(System.in);
		
	//	boolean Q = false;
		
		
		int loopVal = 0;
		boolean loop = true;
		while( loopVal < 1 && loop == true){
			//Prompt user for dollar amount
		System.out.print("Enter the dollar amount $");
		dollars = scan.nextDouble();
		loopVal ++;
		loop = false;
			while( loopVal == 1 && loop == false){
				
				System.out.print("Press Q to quit, any other key to resume ");
				String input = scan.nextLine();
				if ( input == "Q") 
					
				loopVal = 1;
					loop = false;
						if ( input != "Q")
							loopVal = 0;
								loop = false;
								
					
					
			}// end if
			
		} //end while
		
			
		
		
	}// end main method
	
}// end class
		
I want the user to quit the while loop from pressing the Q key. But it isnt working
===


import java.util.Scanner;


public class CurrencyConversion{
	
	public static void main(String[] args){
		// declare and initialize variables
		double dollars = 0;
		//double euro = 0;
		// declare scanner
		Scanner scan = new Scanner(System.in);
		
	//	boolean Q = false;
		
		
		int loopVal = 0;
		boolean loop = true;
		while( loopVal < 1 && loop == true){
			//Prompt user for dollar amount
		System.out.print("Enter the dollar amount $");
		dollars = scan.nextDouble();
		loopVal ++;
		loop = false;
			while( loopVal == 1 && loop == false){
				
				System.out.print("Press Q to quit, any other key to resume ");
				String input = scan.nextLine();
				if ( input == "Q") 
					
				loopVal = 1;
					loop = false;
						if ( input != "Q")
							loopVal = 0;
								loop = false;
								
					
					
			}// end if
			
		} //end while
		
			
		
		
	}// end main method
	
}// end class
		