0% found this document useful (0 votes)
36 views4 pages

Study Guide - Information Systems

This study guide provides an overview of important concepts for Exam 1, including: 1) How to write code in Java using classes, methods, and main methods; 2) Common Java keywords like public, static, and void; 3) Using variables to store and manipulate data; 4) Conditional statements like if/else statements to control program flow. 5) Loops like for loops to repeat blocks of code a certain number of times.

Uploaded by

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

Study Guide - Information Systems

This study guide provides an overview of important concepts for Exam 1, including: 1) How to write code in Java using classes, methods, and main methods; 2) Common Java keywords like public, static, and void; 3) Using variables to store and manipulate data; 4) Conditional statements like if/else statements to control program flow. 5) Loops like for loops to repeat blocks of code a certain number of times.

Uploaded by

Shawn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Study Guide Exam 1

Notes to self
- Scanner sc = new Scanner (System.in); = required for user input
- _____ = sc.nextInt(); = user input
- System.exit (1) = Exit
- You call methods with an instance

Count
- Coders use count in order to keep iterations for a loop

Class
- You can think of a class as a code segment

Where do you write code?


- You write the actual code for your programs in a text editor
- Also called source code
- Create source code with extension.java
- Use Javac to create (compile) a file ending.class
- Run the compiled class

-------------------------------------------------------------------------------------------------------------------------------
public static void main(String [] args)
{
System. out.println(“My First Project”);
}
-------------------------------------------------------------------------------------------------------------------------------

main Method
- Whenever a java program starts, it looks for a method called main.
- It will then execute any code within the curly brackets for main
- The parts between the round brackets of main are something called command-line
arguments

Public
- public means that the method can be seen outside of this class

Static
- static means that you don’t have to create a new object

Void
- void means it doesn’t return a value - it just gets on with it
How to share Java Program
https://www.homeandlearn.co.uk/java/sharing_your_java_programmes.html

VARIABLES
- Programs work by manipulating data placed in memory
- The data can be numbers, text, pointers to other memory areas
- The data is given a name so that it can be recalled whenever it is needed
- The name and its value is known as a variable
- Variable names cannot:
- Start with a number
- Variable names cant be the same as java keywords (words that turn blue ex.int)
- They cannot have spaces
- Variable names are case sensitive
- To store something in the variable you type an equals sign and then the value you want to
store
---------------------------------------------------------------------------------------------------------------------------
-
public static void main (String[] args)
{
int first_number;

first_number = 10;

System.out.println(“My First Project”);


}
-------------------------------------------------------------------------------------------------------------------------------
Example above
- This tells java that we want to store a value of 10 in the integer variable that we’ve called
first_number

- If you want to store larger numbers use double

If Statements
-------------------------------------------------------------------------------------------------------------------------------
if (Statement)
{

}
if(user<18)
{

}
-------------------------------------------------------------------------------------------------------------------------------

- This condition says “IF the user is less than 18”


- If the user is not less than 18 then the code between the curly brackets will be

Symbols/Assignment
< Less than

<= Less than or equal to

> Greater than

>= Greater than or equal to

== Exactly equal to

= Is used to assign the value on the right to


the variable on the left

!= Does not equal to

++ + 1

&& AND
|| OR
== HAS A VALUE OF
! NOT
else if ( user > 18 && user < 40 )
else if (user == 45 || user == 50)
Loops

for ( start_value; end_value; increment_number ) {
//YOUR_CODE_HERE
}
for(loopVal =0; loopVal < end_value; loopVal++){}

Method

You might also like