Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
18 views

Introduction To Java Programming - BCB2302

basic of java programming

Uploaded by

Pavi Thra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Introduction To Java Programming - BCB2302

basic of java programming

Uploaded by

Pavi Thra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction to java programming – BCB2302

Module 1: introduction to java

Features of java ‐ JDK Environment & tools like (java, javac,


appletviewer, javadoc, jdb) ‐ OOPs Concepts Class,
Abstraction, Encapsulation, Inheritance, Polymorphism ‐
Difference between C++ and JAVA ‐ Structure of java
program ‐Data types, Variables, Operators, Keywords,
Naming Convention.

1.1) Features of Java:


1) Platform Independent: Java code runs on any device
that has the Java Virtual Machine (JVM).
2) Object-Oriented: Emphasizes concepts such as
objects, classes, inheritance, encapsulation,
polymorphism, and abstraction.
3) Robust and Secure: Java has strong memory
management and security features like byte-code
verification and sandboxing.
4) Multithreading: Supports concurrent execution of
two or more threads.
5) High Performance: Java uses Just-In-Time (JIT)
compilers to enhance performance.
6) Distributed: Facilitates the development of
distributed applications with its extensive networking
capabilities.

1.2) JDK Environment & Tools:


1. java: The launcher for Java applications.
2. javac: The Java compiler that converts source code
into byte code.
3. appletviewer: A tool to run and debug Java applets
without a web browser.
4. javadoc: Generates API documentation from Java
source code comments.
5. jdb: A debugger that helps identify and fix errors in
Java programs.

1.3) OOP Concepts:


Class: Blueprint from which individual objects are
created.
Abstraction: Hiding complex implementation
details and showing only the essential features.
Encapsulation: Wrapping data (variables) and code
(methods) together as a single unit.
Inheritance: Mechanism where one class inherits
the properties and behavior of another.
Polymorphism: Ability to present the same interface
for different underlying forms (methods or objects).

1.4) Difference between C++ and Java:


• Memory Management: C++ uses manual memory
management, whereas Java uses automatic garbage
collection.
• Platform Independence: Java is platform-independent
through the JVM; C++ is platform-dependent.
• Multiple Inheritance: C++ supports multiple
inheritance; Java does not but allows multiple
inheritance of interfaces.
• Pointers: C++ supports pointers; Java does not allow
direct pointer manipulation for safety.
• Compilation and Interpretation: C++ is typically
compiled into machine code; Java is compiled into byte
code and then interpreted by the JVM.

1.5) Structure of a Java Program:


1. Class Declaration
2. Main Method (entry point of the program)
Example program:
public class HelloWorld
{
public static void main (String [] args)
{
System.out.println("Hello, World!");
}
}

1.6) Data Types:


1)Primitive Data Types: byte, short, int, long, float,
double, boolean, char.
2)Non-Primitive Data Types: Strings, Arrays,
Classes, Interfaces.

1.7) Variables:
• Instance Variables: Declared inside a class but
outside methods, constructors, or blocks.
• Class Variables (Static Variables): Declared with the
static keyword.
• Local Variables: Declared inside methods,
constructors, or blocks.

1.8) Operators:
* Arithmetic Operators**: +, -, *, /, %.
* Relational Operators**: ==, !=, >, <, >=, <=.
* Logical Operators**: &&, ||, !.
* Assignment Operators**: =, +=, -=, *=, /=, %=.
* Unary Operators**: ++, --.
* Bitwise Operators**: &, |, ^, ~, <<, >>, >>>.

1.9) Keywords:
Reserved words in Java with predefined meanings,
such as `class`, `public`, `static`, `void`, `if`, `else`,
`switch`, `case`, `try`, `catch`, `finally`, `throw`,
`throws`, etc.

1.10) Naming Conventions:


• Classes and Interfaces: Should start with an
uppercase letter and follow camel case.
Example: `MyClass`, `MyInterface`.
• Methods: Should start with a lowercase letter and
follow camel case.
Example: `myMethod`.
• Variables: Should start with a lowercase letter and
follow camel case.
Example: `myVariable`.
• Constants: Should be all uppercase letters with words
separated by underscores.
Example: `MY_CONSTANT`.

You might also like