0% found this document useful (0 votes)
33 views

Batch 25 Notes

Uploaded by

A K pandey
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)
33 views

Batch 25 Notes

Uploaded by

A K pandey
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/ 4

javaravishanker@gmail.

com

29-August-23
------------
A language is a communication media.

Any language contains two important things

1) Syntax (Rules)
2) Semantics (Structure OR Meaning)

English langugae translation :


--------------------------------
Subject + verb + Object (Syntax)

He is a boy. (Valid)

He is a box. (Invalid)

Example of Progamming Language :


----------------------------------------
int a = 10;
int b = 0;
int c = a/b; //Exception

Note :-
Syntax of the programming language is taken care by compiler.
compiler generates errors if a user does not follow the syntax of the programming
language.

Semantics is taken care by our runtime Environment. It generates Exception if a user does
not follow the semantics.
-------------------------------------------------------------------------
30-Aug-23
----------
What is the difference between statically(strongly) typed language and Dynamically
(loosly) typed language?

Statically(Strongly) typed language :-


---------------------------------------
The languages where data type is compulsory before initialization of a variable are called
statically typed language.
In these languages we can hold same kind of value during the execution of the program.

Ex:- C,C++,Core Java, C#

Dynamically(Loosly) typed language :-


-------------------------------------------
The languages where data type is not compulsory and it is optional before initialization
of a variable then it is called dynamically typed language.

In these languages we can hold different kind of value during the execution of the
program.
Ex:- Visual Basic, Javascript, Python
-------------------------------------------------------------------------
Flavors Of JAVA language :
------------------------------
1) JSE (Java Standard Edition) ->J2SE -> Core Java

2) JEE (Java Enterprise Edition) -> J2EE -> Advanced Java

3) JME (Java Micro Edition) -> J2ME -> Android Application

4) Java FX [out dated by using we can create GUI applications]


-------------------------------------------------------------------------
What is the difference between stan-alone programs and web-related programs?
Standalone Application
--------------------------
If the creation(development), compilation and execution of the program, everthing is done
in a single system then it is called stand-alone program.
Eg:- C, C++, Java, C# and so on.

Stand alone programs are also known as Software OR Desktop application.

As a developer we should always suggest stand alone application to our client, if the
client data is private or if we want to upload the data in the website then we need to
provide a separate username and password to each and every client.

Web - related Application :-


--------------------------------
If creation of the program, compilation of the program and execution of the program,
Everything is done on different places then it is called web related program.
Eg:- Advanced Java, PHP, ASP.NET, Python

Web related programs are also known as websites or web application.

As a developer we should suggest website to our client if the client information is


public.
-----------------------------------------------------------------------
What is a function :-
-----------------------
A function is a self defined block for any general purpose, calculation or printing some
data.

The major benefits with function are :-


-------------------------------------------
1) Modularity :- Dividing the bigger modules into number of smaller modules where each
module will perform its independent task.

2) Easy understanding :- Once we divide the bigger task into number of smaller tasks then
it is easy to understand the entire code.

3) Reusability :- We can reuse a particular module so many number of times so It enhances


the reusability nature.

Note :- In java we always reuse our classes.

4) Easy Debugging :- Debugging means finding the errors, With function It is easy to find
out the errors because each module is independent with another module.

Why we pass parameter to a function :-


--------------------------------------------
We pass parameter to a function for providing more information regrading the function.

Eg:-

userdefined function predefined function


public void start(int a) start(3); // The fan is running in mode 3
{
//start the fan
}
------------------------------------------------------------------------
31-Aug-23
---------
Why functions are called method in java?
----------------------------------------------
In C++ there is a facility to write a function inside the class as well as outside of the
class by using :: (Scope resolution Operator), But in java all the functions must be
declared inside the class only.

That is the reason member functions are called method in java.

Variable --> Field


function ---> Method
-------------------------------------------------------------------------
History of java :
----------------
First Name of Java : OAK (In the year 1991 which is a tree name)

Project Name :- Green Project

Inventor of Java : - James Gosling and his friends

Official Symbol :- Coffee CUP

Java :- Island (Indonesia)


-------------------------------------------------------------------------

Some important points to remember :


-------------------------------------------------------------
The role of compiler :
-------------------------
a) Compilers are used to check the syntax.
b) It also check the compatibility issues(LHS = RHS)
c) It converts the source code into machine code.

Java code :
-------------
a) Java programs must be saved having extension .java

b) java compiler(javac) is used to compile our code.

c) After successful compilation we are getting .class file (bytecode)

d) This .class file we submit to JVM for execution prupose (for executing my java code)

JVM :- It stands for Java Virtual Machine. It is a software in the form of interpreter
written in 'C' language.

Every browser contains JVM, Those browsers are known as JEB (Java Enabled Browsers)
browsers.
-------------------------------------------------------------------------

Why java language is so popular in the It industry :-


--------------------------------------------------------
C and C++ programs are platform dependent programs that means the .exe file created on one
machine will not be executed on the another machine if the system configuration is
different.

That is the reason C and C++ programs are not suitable for website development.

Where as on the other hand java is a platform independent language. Whenever we write a
java program, the extension of java program must be .java. Now this .java file we submit
to java compiler (javac) for compilation process. After successful compilation the
compiler will generate a very special machine code file i.e .class file (also known as
bytecode). Now this .class file we submit to JVM for execution purpose.

The role of JVM is to load and execute the .class file. Here JVM plays a major role
because It converts the .class file into appropriate machine code instruction (Operating
System format) so java becomes platform independent language and it is highly suitable for
website development.

Note :- We have different JVM for different Operating System that means JVM is platform
dependent technology where as Java is platform Independent technology.
-----------------------------------------------------------------------
01-Sep-23
---------
What is the difference between the bit code and byte code.
------------------------------------------------------------------
Bit code is directly understood by Operating System but on the other hand byte code is
understood by JVM, JVM is going to convert this byte code into machine understandable
format (Operating System format).
-----------------------------------------------------------------------
Comments in JAVA :-
------------------
Comments in JAVA :-
------------------------
Comments are used to increase the readability of the program. It is ignored by the
compiler.
In java we have 3 types of comments

1) Single line Comment (//)

2) Multiline Comment (/* ------------------------------- */)

3) Documentation Comment (/** -------------------------- */)

/**
Name of the Project : Online Shopping
Date created :- 12-12-2021
Last Modified - 16-01-2022
Author :- Ravishankar
Modules : - 10 Modules
*/

----------------------------------------------------------------------
Write a program in java to display welcome message :
----------------------------------------------------
public class Welcome
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}

Description of main() method :


-----------------------------------
public :-
--------
public is an access modifier in java. The main method must be declared as public otherwise
JVM cannot execute our main method or in other words JVM can't enter inside the main
method for execution of the program.

If main method is not declared as public then program will compile but it will not be
executed by JVM.

Note :- From java compiler point of view there is no rule to declare our methods as
public.
---------------------------------------------------------------------

You might also like