These questions are about Java. Im new to it, and need to know them.
1) What are the 4 types of integers, in order from smallest to largest?
2) What are te 2 types of numbers with decimals inorder from smallest to largest?
3)What are the 3 differences between a String and a Char?
4)What is a boolean variable and what 2 types of info can it hold?
5)Whats the difference between a "System.out.print" and a "System.out.println"?
6)What are the 3 lines that must be added to any program that gets info from the user?
7)Whats the difference between inputting strings and numbers?
8)Explain when to use a loop, a while loop, and a do/while loop.
9)What are the 3 peices of information used in a FORloop setting? (Example: int count = 0; count < 10; count ++)
10)What as an "IF" statement?
11)Why would someone use a "If....else if....else if..." instead of "if...if...if"
12)How do you decide what info should be placed in a loop? (For while and do/while)
13)What are the 6 numeric comparison operators?
14)What are the 4 sting comparison operators?
15)What are the 3 boolean operators?
16)Please tell me an "if" statement which will only run if the number is between 1 and 10.
17) What does: "X++","Y--", "X+=2","Y-=5", "Z*=8", "R/=2"
Thanks guys.
Need some questions awnsered.
Moderator:Moderators
- HotDog-Cart
- Portablizer
- Posts:3804
- Joined:Sat Jul 16, 2005 12:07 pm
- PSN Username:Lythinca
- Steam ID:scythe_king
- Location:Your IP Address, Connecting...
- Contact:
- HotDog-Cart
- Portablizer
- Posts:3804
- Joined:Sat Jul 16, 2005 12:07 pm
- PSN Username:Lythinca
- Steam ID:scythe_king
- Location:Your IP Address, Connecting...
- Contact:
- bicostp
- Moderator
- Posts:10491
- Joined:Mon Mar 07, 2005 5:47 pm
- Steam ID:bicostp
- Location:Spamalot
- Contact:
Re: Need some questions awnsered.
I don't know Java but there's a few generally accepted definitions for things:
4)What is a boolean variable and what 2 types of info can it hold?
A boolean variable only holds two values: true and false.
7)Whats the difference between inputting strings and numbers?
Strings can be numbers and letters and treated as a line of text, numbers are computed as values.
10)What as an "IF" statement?
What does the word "if" mean? ;P
16)Please tell me an "if" statement which will only run if the number is between 1 and 10.
THIS IS BS CODE NOT JAVA
17) What does: "X++","Y--", "X+=2","Y-=5", "Z*=8", "R/=2"
What does cat? This doesn't make sense without the rest of the question.
In ActionScript:
X++ adds 1 to X and puts the output into X
Y-- subtracts 1 from Yand puts the output into Y
X+=2 adds 2 to X and puts the output into X
Y-=5 subtracts 5 from Y and puts the output into Y
Z*=8 multiplies Z by 8 and puts the output into Z
R/=2 divides R by 2 and puts the output into R
4)What is a boolean variable and what 2 types of info can it hold?
A boolean variable only holds two values: true and false.
7)Whats the difference between inputting strings and numbers?
Strings can be numbers and letters and treated as a line of text, numbers are computed as values.
10)What as an "IF" statement?
What does the word "if" mean? ;P
16)Please tell me an "if" statement which will only run if the number is between 1 and 10.
THIS IS BS CODE NOT JAVA
Code: Select all
if 1 < number < 10
do.stuff
else
dont.do.stuff
end if
What does cat? This doesn't make sense without the rest of the question.
In ActionScript:
X++ adds 1 to X and puts the output into X
Y-- subtracts 1 from Yand puts the output into Y
X+=2 adds 2 to X and puts the output into X
Y-=5 subtracts 5 from Y and puts the output into Y
Z*=8 multiplies Z by 8 and puts the output into Z
R/=2 divides R by 2 and puts the output into R
Twitter
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
- HotDog-Cart
- Portablizer
- Posts:3804
- Joined:Sat Jul 16, 2005 12:07 pm
- PSN Username:Lythinca
- Steam ID:scythe_king
- Location:Your IP Address, Connecting...
- Contact:
A couple of revisions to Bic:
7) Your prof probably wants you to say that a string holds the ascii representations of text, whereas numbers are just that: numbers. So when inputting usually you will receive the ascii representations of things
i.e. When you type 1 into a computer the computer actaully sees the ascii version of 1 which is 81 (base 10).
16) in Java:
Note that the else is purely optional.
17.
Some important things to say about X++ and Y-- is that they are post op's, meaning that they execute AFTER the rest of the instruction. As opposed to ++X and --Y which execute BEFORE the rest of the instruction.[/code]
7) Your prof probably wants you to say that a string holds the ascii representations of text, whereas numbers are just that: numbers. So when inputting usually you will receive the ascii representations of things
i.e. When you type 1 into a computer the computer actaully sees the ascii version of 1 which is 81 (base 10).
16) in Java:
Code: Select all
int i = number;
if(1<i && i<10){// && means AND. & means boolean AND.
//Execute CODE
}else{
//DO NOT EXECUTE CODE
}
17.
Some important things to say about X++ and Y-- is that they are post op's, meaning that they execute AFTER the rest of the instruction. As opposed to ++X and --Y which execute BEFORE the rest of the instruction.[/code]
Code: Select all
1) short int, int, long int, long long int
2) float, double
3) chars are 1 byte, strings are a group of chars, strings are null-terminated
4) a boolean (bool) is a false/true (0/1) variable
5) println moves the console cursor to the next line (/n)
6) import java.io.Console;
import java.util.Arrays;
import java.io.IOException;
7) numbers are formatted as decimal/hexadecimal, strings are formatted for ASCII
8) overbearingly obvious
9) define counting value; while command; pre/post value altering
10) ...
11) else if is used to follow an if or another else if to assure only one of the conditions is executed
12) ...
13) <, <=, >, >=, ==, !=
14) ...
15) AND, OR, NOT
16) if(x >= 1 && x <= 10)
17) increment x, decrement y, add 2 to x, subtract 5 from y, multiply z by 8 (store in z), divide r by 2 (store in r)