Beginner-Friendly Java Prep Guide (for Drivestream)
PART 1: Java Basics You Must Know
1. Java Syntax Essentials
• Structure of a Java Program
java
CopyEdit
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, Drivestream!");
This is your “main” entry point. System.out.println() prints to console.
2. Variables and Data Types
java
CopyEdit
int age = 22;
String name = "Sandhiya";
boolean isPlaced = false;
3. Control Structures
java
CopyEdit
if(age >= 18){
System.out.println("Eligible");
} else {
System.out.println("Not eligible");
for(int i = 1; i <= 5; i++){
System.out.println(i);
}
PART 2: OOP in Java — Beginner Level
OOP is the heart of Java — and Drivestream will want you to know at least the basics.
1. Class & Object
java
CopyEdit
public class Student {
String name;
int age;
void introduce() {
System.out.println("Hi, I'm " + name);
public static void main(String[] args) {
Student s1 = new Student();
s1.name = "Abhi";
s1.age = 21;
s1.introduce();
2. Inheritance
java
CopyEdit
class Employee {
void work() {
System.out.println("Working...");
}
class Developer extends Employee {
void code() {
System.out.println("Coding in Java...");
public static void main(String[] args) {
Developer dev = new Developer();
dev.work(); // from Employee
dev.code(); // from Developer
3. Polymorphism (Method Overriding)
java
CopyEdit
class Animal {
void sound() {
System.out.println("Animal sound");
class Dog extends Animal {
void sound() {
System.out.println("Bark!");
PART 3: Java + Database (JDBC)
This is super important for Drivestream.
java
CopyEdit
import java.sql.*;
public class JdbcExample {
public static void main(String[] args) throws Exception {
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/dbname", "user", "password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM employees");
while(rs.next()) {
System.out.println(rs.getString("name"));
conn.close();
PART 4: Common Java Interview Qs (Beginner Edition)
Question What to Say
Object-oriented, platform-independent programming
What is Java?
language.
What is OOP? Programming model based on classes & objects.
Difference between class and object? Class is blueprint; object is instance of class.
What is inheritance? One class inherits properties from another.
What is method overloading? Same method name, different parameters.
How does Java connect to a
Using JDBC (Java Database Connectivity).
database?