Java Language Fundamentals (SCJP)

Jun 24, 2024

Java Language Fundamentals (SCJP)

Key Topics

1. Introduction to SCJP

  • SCJP stands for Sun Certified Java Programmer.
  • Covers core Java concepts.
  • Emphasis on language features, syntax, and structures.

2. Language Fundamentals

Keywords

  • Reserved words in Java that have predefined meanings in the language.
  • Examples: int, boolean, char, class, public, final, etc.

Identifiers

  • Names given to various program elements such as variables, methods, classes, etc.
  • Must begin with a letter, currency character ($), or underscore (_).
  • Cannot start with a number.

Data Types

  • Primitive Types: byte, short, int, long, float, double, char, boolean.
  • Reference Types: Objects and arrays.

Literals

  • Constant values assigned to variables.
  • Types: integer literals, floating-point literals, boolean literals, character literals, and string literals.

3. Syntax and Code Structure

Classes and Interfaces

  • Class: Blueprint from which individual objects are created. Syntax: class ClassName {}
  • Interface: Abstract type used to specify behaviors that classes must implement. Syntax: interface InterfaceName {}

Methods

  • Blocks of code that perform a specific task and are defined within a class.
  • Method structure: modifiers, return type, method name, parameter list, method body.

4. Variable Scope

Instance Variables

  • Declared in a class, but outside any method, constructor, or block. They are instance-specific.

Class Variables (Static Variables)

  • Declared with the static modifier.
  • Shared among all instances of a class.

Local Variables

  • Declared within a method, constructor, or block.
  • Only accessible within the declared scope.

Parameters

  • Variables passed to methods as input.

Summary

  • Understanding these fundamentals is crucial for SCJP.
  • Emphasis on syntax, data types, variables, and program structure.