I'm a rather beginner-ish coder (with some C/JS/Ruby experience), so in my efforts to acquire a coding job (and help as many people as best I can, see my website GohstIndustries for a complete zip file of my life's works, totally free), I'm intending to post here consistently daily some of the coding things I've learned for the day. They are copied verbatim from my personal notebooks, which are (sometimes) paraphrased versions of sources I'm getting the information from, in any case I'm listing reference/credits to each information source in each post as they are written at the top of each notes page in my notebooks. Hopefully this thread will be of use to readers as well as in my coding job search (if any of you know someone who needs some coding work done please keep me in mind as my skills progress, thanks).
Here's post number 1 1/2:
(info source unknown, due to notes being written pre-blogging-intents)
-Scanner class is really useful for handling user input
-the java.util library contains the Scanner class
-use keyword import to reference classes (i.e. import java.util.Scanner)
-import statements need to go just above Class statements
-A class needs objects to be able to do anything
-To create a new Scanner object: Scanner usr_input =new Scanner(System.in);
-keyword new is used to create new objects from a class
-next is a Scanner method that gets the next text string from user input, i.e.:
Scanner input_text = new Scanner(System.in);
String name;
name = input_text.next();
-print and println are methods of System.out
-print stays on the same line, println moves cursor to new line(\n)
-java.io package contains many input/output (I/O) classes
-there are two kinds of streams (data sequences):
InPutStream: used to read data from a source
OutPutStream: used to write data to a destination
-a directory is a file which can contain a list of other files & directories
-objects represent real-world objects
-objects have states & behaviors, with states being stored as fields & methods for behaviors
-Classes can contain 3 types of variables:
-Local Variables: Defined inside methods, constructors, or blocks; declared & initialized within method, removed after
-Instance Variables: within a class but outside methods; initialized with class initialization; can be accessed from within respective class
-Class variables: declared within class, outside methods, with static keyword
-static indicates class variable
-every class has a constructor
-constructors must have the same name as the class
-classes can have more than one constructor
singleton classes are for only creating a single instance of a class
-3 steps for creating objects from classes:
1. Declaration: variable declaration with a variable name & object type
2. Instantiation: creates objects with "new" keyword
3. Initialization: "new" keyword followed by constructor call to initialize the new object
Rules for declaring source files:
-each source file can only have one public class
-multiple non-public classes are allowed for each source file
-the file name (appended with ".java") should match the public class name
-package statements should be the first statement of a source file if the class is defined inside a package
-import statements (when present) must be written between the package statement and class declaration
-java packages are a way of categorizing classes & interfaces
-import statements are a way of giving the proper location for the compiler to find a particular class
-extends is the keyword used to inherit the properties of a class
-the extends syntax is as follows:
class Super
{
...
}
class Sub extends Super
Here's post number 1 1/2:
(info source unknown, due to notes being written pre-blogging-intents)
-Scanner class is really useful for handling user input
-the java.util library contains the Scanner class
-use keyword import to reference classes (i.e. import java.util.Scanner)
-import statements need to go just above Class statements
-A class needs objects to be able to do anything
-To create a new Scanner object: Scanner usr_input =new Scanner(System.in);
-keyword new is used to create new objects from a class
-next is a Scanner method that gets the next text string from user input, i.e.:
Scanner input_text = new Scanner(System.in);
String name;
name = input_text.next();
-print and println are methods of System.out
-print stays on the same line, println moves cursor to new line(\n)
-java.io package contains many input/output (I/O) classes
-there are two kinds of streams (data sequences):
InPutStream: used to read data from a source
OutPutStream: used to write data to a destination
-a directory is a file which can contain a list of other files & directories
-objects represent real-world objects
-objects have states & behaviors, with states being stored as fields & methods for behaviors
-Classes can contain 3 types of variables:
-Local Variables: Defined inside methods, constructors, or blocks; declared & initialized within method, removed after
-Instance Variables: within a class but outside methods; initialized with class initialization; can be accessed from within respective class
-Class variables: declared within class, outside methods, with static keyword
-static indicates class variable
-every class has a constructor
-constructors must have the same name as the class
-classes can have more than one constructor
singleton classes are for only creating a single instance of a class
-3 steps for creating objects from classes:
1. Declaration: variable declaration with a variable name & object type
2. Instantiation: creates objects with "new" keyword
3. Initialization: "new" keyword followed by constructor call to initialize the new object
Rules for declaring source files:
-each source file can only have one public class
-multiple non-public classes are allowed for each source file
-the file name (appended with ".java") should match the public class name
-package statements should be the first statement of a source file if the class is defined inside a package
-import statements (when present) must be written between the package statement and class declaration
-java packages are a way of categorizing classes & interfaces
-import statements are a way of giving the proper location for the compiler to find a particular class
-extends is the keyword used to inherit the properties of a class
-the extends syntax is as follows:
class Super
{
...
}
class Sub extends Super
Comment