GRADE 11
JAVA MATERIAL FOR GRADE 11 STUDENTS
Gr 11 12 Not !
In Java "not" is a bit awkward when used with a String method like "equals" if (name.equals("steve") { } is easy to understand. If the name equals "steve" then execute the code block that follows. What about if the name does not equal steve? if ( !...
Gr 11 – Switch Case
Complex "if-then-else" statements are needed when there are many options e.g. consider all the options in a menu. Fortunately, there is a better way when a lot of options are needed i.e. the "Switch-Case-Break" construct. It works exactly the same as "if-else" but its...
Gr 10 11 – SQL summary
Here is a paried down SQL summary suitable for grade 10 and 11. Version 10 Click here
Gr 11, 12 – SQL tips
SQL TIPS for exams. STUDY the database first (at least 5 full minutes). Study both the data and the fields. Know how many records are in each table so that you can recognize any potential errors in the returned dataset. The better you understand the database, the...
Gr 11 – OOP, String, LocalTime, write to file
Asks for your full name and ID number. Determines the time right now. It reformats the name. It reformats the date of birth from the ID number. It determines the gender from the ID number. It creates a single output String which it prints to both the monitor and an...
Gr 11 OOP and String
Here is a PowerPoint showing the following. Using String handling with OOP - a UI class for the interface and a manager class for the methods. Organizing your One Drive account with your coding projects using NetBeans.Passing a string parameter from one method to...
Gr 11 – Write to text file
A Java program to write to a text file using PrintWriter (not FileWriter). This program reads in a text file using Scanner - a date and a boolean flag. It adds 45 days to the date and compliments the flag (true to false and false to true) It then writes the new data...
The split method
Reading in a text file into an array of objects using the split( ) method in Java. (There are other ways of doing this for example using useDelimiter( ) with next( ) ) Here is the text file using "#" as the delimiter. Note that there are no extra spaces or strange...
Java NetBeans 17
Java version 17 (JDK 17) is a LTS (Long Term Support version of Java). We use this version together with Apache NetBeans version 17. It is a good idea to uninstall any previous versions of Java and NetBeans using Windowns Control Panel, Uninstall software. Click here...
Gr 11 – Date time methods
Java - LocalDate, LocalTime, LocalDateTime These date time classes have a number of methods. Here is the list . . . Cautionary: Some of these methods are static, some are non-static, some need parameters, some are void, some are typed. See code examples for more...