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

Features java

The document compares C and Java programming languages, highlighting their differences in programming paradigms, memory management, and features. It provides an overview of Java's history, its development by Sun Microsystems, and its key features such as portability, security, and object-oriented design. Additionally, it outlines various applications of Java and the types of Java applications, including J2SE, J2EE, and J2ME.

Uploaded by

sachintaba9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Features java

The document compares C and Java programming languages, highlighting their differences in programming paradigms, memory management, and features. It provides an overview of Java's history, its development by Sun Microsystems, and its key features such as portability, security, and object-oriented design. Additionally, it outlines various applications of Java and the types of Java applications, including J2SE, J2EE, and J2ME.

Uploaded by

sachintaba9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

OOPS USING JAVA- BCA-NEP-301

C AND JAVA

C Java
C is a Procedural Programming
Java is an Object-Oriented language.
Language.
C was developed by Dennis M. Ritchie Java language was developed by James
in 1972. Gosling in 1995.
It is a high-level language because the
It is a middle-level language as it is
translation of code is taken place into
binding the gaps between machine
machine language, which uses
level and high-level languages.
compiler or interpreter.
In the C declaration variable are In Java, you can declare a variable
declared at the beginning of the block. anywhere.
C support pointers. Java does not support pointers.
Memory allocation can be done by Memory allocation can be done by a
malloc. new keyword.
C does not have a feature of
Java supports method overloading.
overloading functionality.
C offers support for call by value and
Java only supports a call by value.
call by reference.

Disadvantage of C
• C does not offer the concept of OOPs.
• It is a small and core machine language that offers minimum data hiding
and exclusive visibility that affects the security of this language.
• C doesn’t have the concept of constructor and destructor.
• No website development.
• GUI tools are not available.
Print Hello in ‘C’.
#include<stdio.h>
#inclide<conio.h>
void main()
{
printf("Hello World!");
getch();
}
OBJECT ORIENTED PROGRAMMING CONCEPTS

FIRST PROGRAM IN JAVA

class FirstProgram
{
public static void main(String args[])
{
System.out.println("This is my First Program ");
}
}

Program Compilation Process:

When we compile Java program using javac command, the Java compiler
converts the source code into byte code (class code).
Parameters used in First Java Program

Let's see what is the meaning of class, public, static, void, main, String[],
System.out.println().
o class keyword is used to declare a class in Java.
o public keyword is an access modifier that represents visibility to call the
method.
o static is a keyword. If we declare any method as static, it is known as the
static method, no need to create an object to invoke the static
method.We are using this here because main() method is executed by the
JVM
o void is the return type of the method. It means it doesn't return any value.
o main represents the starting point of the program.
o String[] args or String args[] is used for command line argument. We will
discuss it in coming section.
o System.out.println() is used to print statement. Here, System is a class,
out is an object of the PrintStream class, println() is a method of the
PrintStream class.

Note: All classes in the java.lang package are imported by default. Thus you do
not need to import java.lang.*; to use them without fully qualified names.
ABOUT JAVA

James Gosling initiated Java language project in June 1991 for use in one of his
many set-top box projects. The language, initially called ‘Oak’ after an oak tree
that stood outside Gosling's office, also went by the name ‘Green’ and ended up
later being renamed as Java, from a list of random words.
James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language
project in June 1991.
Java programming language was originally developed by Sun Microsystems
which was initiated by James Gosling and released in 1995 as core component
of Sun Microsystems' Java platform (Java 1.0 [J2SE]). It promised Write Once,
Run Anywhere (WORA) functionality. Major web browsers soon incorporated
the ability to run Java applets within web pages, and Java quickly became
popular.
Java was originally designed for interactive television, but it was too advanced
for the digital cable television industry at the time. The language was initially
called Oak after an oak tree that stood outside Gosling's office. Later the project
went by the name Green and was finally renamed Java, from Java coffee, a type
of coffee from Indonesia. Gosling designed Java with a C/C++-style syntax that
system and application programmers would find familiar.

FEATURES OF JAVA:
Cross-Platform Portability
The JVM provides cross-platform portability. You write code for the JVM, not for
the operating system (OS). Because all JVMs look the same to Java programs,
you have to write only one version of your program, and it will work on all JVMs.
The JVM interprets the byte-code and carries out the program's operations in a
way that is compatible with the current hardware architecture and operating
system.
SIZE
The second interesting side effect of using JVM architecture is the small size of
its compiled code. Most of the functionality is buried in the JVM, so the compiled
code that runs on top of it doesn't need to be loaded with large libraries. Of
course, the JVM is, among other things, a large library, but it is shared among all
Java programs. That means that a Java program can be quite small— at least,
the part of the program that is uniquely yours. This is especially important when
users are downloading programs over the Internet, for example. Of course, if
users' computers don't have a JVM, they'll have a large download for installing
the JVM on their machines first. After the JVM installs, the users won't have to
worry about installing again.

SECURITY
Java has been designed to protect users from malicious programs. Programs
from an untrusted source (for example, the Internet) execute in a restricted
environment (known as a sandbox). The JVM can then prevent those programs
from causing mischief. For example, a Java applet (a small program that runs on
a Web page) usually can't access local files or open network connections to
arbitrary computers. These restrictions prevent a Web page from erasing your
critical files or sending threatening email from your computer.
Some features are:

Object Oriented − In Java, everything is an Object. Java can be easily extended


since it is based on the Object model.

Simple − Java is designed to be easy to learn. If you understand the basic concept
of OOP Java, it would be easy to master.
Architecture-neutral − Java compiler generates an architecture-neutral object
file format, which makes the compiled code executable on many processors,
with the presence of Java runtime system.

Portable − Being architecture-neutral and having no implementation dependent


aspects of the specification makes Java portable. Compiler in Java is written in
ANSI C with a clean portability boundary.

Robust − Java makes an effort to eliminate error prone situations by


emphasizing mainly on compile time error checking and runtime checking.

Multithreaded − With Java's multithreaded feature it is possible to write


programs that can perform many tasks simultaneously. This design feature
allows the developers to construct interactive applications that can run
smoothly.

Interpreted − Java byte code is translated on the fly to native machine


instructions and is not stored anywhere. The development process is more rapid
and analytical since the linking is an incremental and light-weight process.

High Performance − With the use of Just-In-Time compilers, Java enables high
performance.

Distributed − Java is designed for the distributed environment of the internet.

Dynamic − Java is considered to be more dynamic than C or C++ since it is


designed to adapt to an evolving environment. Java programs can carry
extensive amount of run-time information that can be used to verify and resolve
accesses to objects on run-time.
APPLICATION WHERE WE CAN USE JAVA
According to Sun, 3 billion devices run Java. There are many devices where Java is currently
used. Some of them are as follows:
1. Desktop Applications such as acrobat reader, media player, antivirus, etc.
2. Web Applications such as irctc.co.in
3. Enterprise Applications such as banking applications.
4. Mobile
5. Embedded System
6. Smart Card
7. Robotics
8. Games, etc.
TYPES OF JAVA APPLICATIONS
There are mainly 4 types of applications that can be created using Java programming:
J2SE: Used primarily to create programs for desktop computers or for any computer too large
for J2ME and too small for J2EE.

J2EE: Used to create very large programs that run on servers managing heavy traffic and
complicated transactions. These programs are the backbone of many online services, such as
banking, e-commerce, and B2B (business-to-business) trading systems.

J2ME: J2ME (Micro Edition)— Used to create programs that run on small handheld devices,
such as phones, PDAs (personal digital assistants), and appliances.

You might also like