This will teach you about the basics of programming if you are new and have no clue where to start. An important tool to all programmers is a search engine, so there is no shame in looking up concepts that you may not understand in-depth.
- Syntax: Grammar of programming languages
Variables store pieces of information to be referenced or manipulated.
Boolean
- a true or false valueInteger
- an integerDouble
- any number or decimalString
- a 'string' of textCharacter
- a single letter/number
There are many other types of variables besides these.
Methods are used as a triggerable action, Commonly called functions. Two common uses of functions are start
and stop
A class is a template or blueprint used to create a set of objects called instances. The class stores data that is shared by all instances, and is the main container of methods and properties.
Objects are single instances of a class, and inherit key aspects from the base class. Objects can have seperate aspects that make them unique.
OOP is a framework used to clearly organize your code, which helps with reducing redundant code, reusing code, troubleshooting, and solving complex programming challenges.
public class Main {
public static void main(String args[]) {
//Whole Number data types
byte eByte = 127;
short eShort = 32767;
int eInt = 2147483647;
long eLong = 922337203685475580L;
//Decimal/Floating point
float eFloat = 243.1f; //Random number, not max positive value
double eDouble = 2343.1; //Random number, not max positive value
//<Type>.MAX_VALUE
//By Java convention, first letter of variable is always lowercase in order to differentiate a class from a variable.
System.out.println(eFloat + 1000 + "1000");
System.out.println(eFloat + eDouble + eByte);
//How do you print the values on the same line without adding them
System.out.println(Float.toString(eFloat) + " " + Double.toString(eDouble));
// Backlash n (to enter)
}
}
--
1243.11000
2713.2000061035155
243.1 2343.1
Process finished with exit code 0