Q How to run java code in VS Code:-
Download and install JDK and Visual Studio Code (VS Code) according to your system.
Now open the Visual Studio Code and click on extension icon and search “code Runner” . Now
click on install button. Installation starts automatically.
Again go to the extension icon and search “Java” title is “Language Support for java”.
Now click on install button, installation starts automatically .
Q What are the important
features of java?
The most important features of the Java
language are given below.
Simple:- Java is very easy to learn, and its syntax
is simple, clean and easy to understand.
Object-Oriented:- Java is
an object-oriented programming language. Everything in Java is an
object.
Portable:- Java is
portable because it facilitates you to carry the Java bytecode to any platform.
It doesn't require any implementation.
Platform
independent:- Java code is compiled by the compiler and converted
into bytecode. This bytecode is a platform-independent code because it can be
run on multiple platforms, i.e., Write Once and Run Anywhere (WORA).
Secured:- Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:
1 No explicit pointer
2 Java Programs run inside a virtual machine sandbox
Robust:- Java is robust because it uses strong memory management, automatic garbage
collection, and exception handling.
Architecture neutral:- Java is architecture neutral because there are no
implementation dependent features, for example, the size of primitive types is
fixed.
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-bit architectures in Java.
High
Performance:-Java is faster than other traditional interpreted
programming languages because Java bytecode is "close" to native
code. It is still a little bit slower than a compiled language (e.g., C++).
Java is an interpreted language that is why it is slower than compiled
languages, e.g., C, C++, etc.
Multithreaded:- We can
write Java programs that deal with many tasks at once by defining multiple
threads. The main advantage of multi-threading is that it doesn't occupy memory
for each thread. It shares a common memory area.
Dynamic:- Java is a
dynamic language. It supports the dynamic loading of classes. It means classes
are loaded on demand.
Q What is the history of
JAVA?
Java was
developed by James Gosling, who is known as the father of Java, in 1995. James
Gosling and his team members started the project in the early '90s. The main
aim for creating Java programming were "Simple, Robust, Portable,
Platform-independent, Secured, High Performance, Multithreaded, Architecture
Neutral, Object-Oriented, Interpreted, and Dynamic". Java language
was developed for digital devices such as set-top boxes, televisions, etc.
However, it was best suited for internet programming. Later, Java technology
was incorporated by Netscape. Currently, Java is used in internet programming,
mobile devices, games, e-business solutions, etc.
Q What is main difference
and similarities between C++ and Java?
There are many
differences and similarities between the C++ programming language
and Java. Some of them are as follows:-
C++ |
Java |
C++ is
platform-dependent. |
Java is
platform-independent. |
C++ is mainly
used for system programming. |
Java is mainly
used for application programming. It is widely used in Windows-based,
web-based, enterprise, and mobile applications. |
C++ was designed
for systems and applications programming. It was an extension of the C
programming language . |
Java was designed
and created as an interpreter for printing systems but later extended as a
support network computing. It was designed to be easy to use and accessible
to a broader audience. |
No comments:
Post a Comment