This course familiarizes students with basic as well as advanced features of Java Programming Emphasis will be given to GUI and event-driven programming, Database Connectivity, Socket Programming, Servlets and JSP Technology, and Distributed Programming.
CSC419Semester VII3 credit hours8 units86 solved questions1,127 study cardsFull study modes
This course familiarizes students with basic as well as advanced features of Java Programming Emphasis will be given to GUI and event-driven programming, Database Connectivity, Socket Programming, Servlets and JSP Technology, and Distributed Programming.
The free sample is open to everyone. Sign in for 2 free weeks of every answer, flashcards and progress.
This unit lays the groundwork for advanced Java by covering how the JVM compiles and runs a program, the language features that define Java, its core object oriented building blocks, exception handling, concurrency, and file handling, all of which the rest of the course builds on.
A Java program begins life as source code in a .java file. The Java compiler (javac) translates this source code into bytecode, a platform-neutral instruction set stored in a .class file. Bytecode is not native machine code; it is object code meant for the Java Virtual Machine (JVM), not for any particular processor.
When the program runs, the class loader locates and loads the .class files the program needs, whether they come from the local file system or over a network. Before execution, the bytecode verifier checks that the code obeys the JVM specification: that it does not access memory without authorization, cannot overflow the stack, and performs no illegal type conversions (such as treating a float as an object reference). Once verified, the JVM's just in time (JIT) compiler translates the bytecode into native machine code for the host processor, caching the translated code so it can be reused without recompiling on every call. The Java Runtime Environment (JRE), which bundles the JVM with the core class libraries, then hands this native code to the operating system for execution. This compile-once, verify-and-translate-at-runtime pipeline is what lets the same .class file run unmodified on any platform that has a JVM.
Sun Microsystems described Java using a set of buzzwords that summarize its design goals.
PATH is an operating system environment variable that tells the shell where to find executables such as java and javac; it points at the bin directory of the installed JDK. CLASSPATH is a separate variable that tells the compiler and the JVM where to find the compiled .class files and library .jar files a program depends on. In short, PATH locates the JDK's own tools, while CLASSPATH locates the classes a program uses. An IDE such as Eclipse or IntelliJ sets both automatically; PATH and CLASSPATH only need to be configured by hand when compiling and running from the command line.
Every standalone Java program needs a class containing a main method, which is where the JVM begins execution:
class Sample {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}
The file must be saved as Sample.java, matching the public class name. To read input from the console, Java provides the Scanner class in the java.util package:
import java.util.Scanner;
class UserInputDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string: ");
String str = sc.nextLine();
System.out.println("You have entered: " + str);
}
}
Compilation and execution are two separate steps. javac Sample.java invokes the compiler, which checks the source for syntax errors and, if it compiles cleanly, produces Sample.class containing bytecode. java Sample then starts the JVM, which loads Sample.class, verifies it, and calls its main method. The class name passed to java must match the name of the class that declares main, not the file name, though for a single public class the two are the same.
An array is a collection of elements of the same type stored under one variable name, in contiguous memory. Java arrays are objects, so their length is fixed once created and is available through the length field.
A single dimensional array is declared and used as follows:
class TestArray {
public static void main(String[] args) {
int[] arr = new int[5]; // declaration
arr[0] = 10; // initialization
arr[1] = 20;
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
A multidimensional array, such as int[][] arr = new int[3][3];, models a grid: here, 3 rows by 3 columns, accessed as arr[row][col].
The for-each loop is an alternative way to traverse an array or any Iterable collection without managing an index:
int[] a = {10, 11, 12, 13};
for (int i : a) {
System.out.println(i);
}
Its advantage is readability and the elimination of off-by-one indexing bugs; its limitation is that it always moves forward through every element and cannot skip elements or run in reverse, because it is not index based.
Advanced Java Programming for TU BSc CSIT is covered here in full, from syllabus notes to solved past questions. This subject has 8 chapters mapped to the official syllabus, and 86 past exam questions with written model answers. The opening of every note and answer is free, and the most-searched questions are free in full. A free account gets 2 free weeks of the whole program plus flashcards and progress tracking so weak topics come back before the exam.
This TU BSc CSIT Advanced Java Programming guide covers Programming in Java, User Interface Components with Swing, Event Handling, Database Connectivity, Network Programming, GUI with JavaFX, Servlets and Java Server pages, RMI and CORBA, across 8 chapters. It includes model answers to 86 past exam questions, plus flashcards for quick revision.
Advanced Java Programming has 8 chapters mapped to the official syllabus.
Yes. Each of the 86 past questions comes with a written model answer; the most-searched ones are free in full, the rest open with a free account's 2 free weeks or a pass.
Free to start. The opening of every note and answer is free, the most-searched questions are free in full, and a free account gets 2 free weeks of the whole program plus flashcards and progress tracking. After that a program pass keeps everything open.
Based on the official syllabus.