0% found this document useful (0 votes)
16 views2 pages

Java Code Examples for User Input

The document contains code snippets involving variables, data types, Scanner input, and JOptionPane input to get user input for calculations.

Uploaded by

ma21295
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Java Code Examples for User Input

The document contains code snippets involving variables, data types, Scanner input, and JOptionPane input to get user input for calculations.

Uploaded by

ma21295
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Double temp, weight, age;

3. int months = 2, days, years = 3;

7. 10 20 1

11.

int speed; 20;

int time; 10;

int distance = speed * time;

[Link](distance);

13.

import [Link];

public class Main {


public static void main(String[] args) {

Scanner keyboard = new Scanner([Link]);

[Link]("Please enter your desired annual income:");

double annualIncome = [Link]();

[Link]();

14. import [Link];

public class Main {


public static void main(String[] args) {
String input = [Link]("Enter your desired
annual income:");
double annualIncome = [Link](input);
[Link]("Your desired annual income is: " +
annualIncome);
}
}

You might also like