Thursday, 27 June 2019

Application of Java


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, javatpoint.com, etc.
  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:

1) Standalone Application
Standalone applications are also known as desktop applications or window-based applications. These are traditional software that we need to install on every machine. Examples of standalone application are Media player, antivirus, etc. AWT and Swing are used in Java for creating standalone applications.

2) Web Application
An application that runs on the server side and creates a dynamic page is called a web application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are used for creating web applications in Java.

3) Enterprise Application
An application that is distributed in nature, such as banking applications, etc. is called enterprise application. It has advantages of the high-level security, load balancing, and clustering. In Java, EJB is used for creating enterprise applications.

4) Mobile Application
An application which is created for mobile devices is called a mobile application. Currently, Android and Java ME are used for creating mobile applications.

Java Platforms / Editions
There are 4 platforms or editions of Java:

1) Java SE (Java Standard Edition)
It is a Java programming platform. It includes Java programming APIs such as java.lang, java.io, java.net, java.util, java.sql, java.math etc. It includes core topics like OOPs, String, Regex, Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing, Reflection, Collection, etc.

2) Java EE (Java Enterprise Edition)
It is an enterprise platform which is mainly used to develop web and enterprise applications. It is built on the top of the Java SE platform. It includes topics like Servlet, JSP, Web Services, EJB, JPA, etc.

3) Java ME (Java Micro Edition)
It is a micro platform which is mainly used to develop mobile applications.

4) JavaFX
It is used to develop rich internet applications. It uses a light-weight user interface API.

Python program to convert kilometers to miles Kilometer

The kilometer is a unit of length in the metric system. It is equivalent to 1000 meters.
Miles:

Mile is also the unit of length. It is equal to 1760 yards.

Conversion formula:

1 kilometer is equal to 0.62137 miles.

Miles = kilometer * 0.62137 
Kilometer = Miles / 0.62137 
See this example:

# Collect input from the user 
kilometers = float(input('How many kilometers?: ')) 
# conversion factor 
conv_fac = 0.621371 
# calculate miles 
miles = kilometers * conv_fac 
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

Tuesday, 11 June 2019

Python program to check if the input number is odd or even


# A number is even if division by 2 give a remainder of 0.
# If remainder is 1, it is odd number.

num = int(input("Enter a number: "))
if (num % 2) == 0:
   print("{0} is Even".format(num))
else:
   print("{0} is Odd".format(num))