UrbanPro
true

Take Engineering Diploma Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

basic concepts in java

Amarnath Reddy
19/04/2017 0 0

Introduction

Sun Microsystems created the Java language. Java is a case-sensitive programming language, like C++. Java is an Object Oriented Programming (OOP) structure. Java is a class based programming language.

  • Java technology is used for developing both applets and applications.
  • Provides an easy to use:

    1. Avoids many of the pitfalls of other languages
    2. Bing object oriented
    3. Enables code streamlining

  • Provides an interpreted environment:

    1. Improved speed of development.
    2. Code portability.

  • Loads classes dynamically, in other words when they are actually needed.
  • Supports changing programs dynamically during runtime by loading classes from a distinct source.
  • Furnishes better security.
  • Enables use of more than one thread of an activity.
  • The Java Virtual Machine (JVM).
  • Garbage collection.
  • The Java Runtime Environment (JRE).
  • JVM tool interface.
  • JVM provides definitions for the:

    1. Instruction Set (Central Processing Unit (CPU))
    2. Register set
    3. Class file format
    4. Runtime stack
    5. Garbage–collected head
    6. Memory area
    7. Fatal error reporting mechanism
    8. High –precision timing support

  • Garbage collection has the following characteristics:

    1. Check for and frees memory no longer needed , automatically.
    2. Provides a system-level thread to track memory allocation.

  • The JVM does the following three main tasks:

    1. Loads code: performed by the class loader.
    2. Verifies code: performed by the byte code verifies.
    3. Executes code: performed by the runtime interface.

  • There are the following five primary workflows of a software developing project:
  • Requirement capturing, analysis, design, implementation and testing.
  • Abstraction means ignoring the non-essential details of an object and concentrating on its essential details.
  • Encapsulation provides data representation flexibility by hiding the implementation details of a class. Loads all the classes necessary for the execution of the program.
  • Maintains classes of the local file system in a separate namespace.
  • Avoids execution of the program whose byte code has been changed illegally.

Example with simple Java program

Open Notepad and type in this program, maintaininig the upper and lower case, because Java is a case-sensitive programming language.

 
  1. class Basic 
  2. {  
  3.       public static void main (String []args)  
  4.       {  
  5.             System.out.println(“("Welcome to Basic concept of Java");  
  6.       }  
  7. }  

 

  • After writing this code then save the program. When you save it you need to save the program with only the class name like:

    Basic.java //.java is extension of Java file

  • After saving, compile and run the program so you need to open a “cmd”. Click the Window button and type “cmd” then hit Enter and open a “cmd” then type the cmd command for going to the location where your Java program is, like mine is at “desktop” so I need to type:

    cd desktop

  • Then show desktop on your cmd then type the following to compile:
    javac Basic.java
    //javac for Java compile

  • When your Java program will be compiled successfully with no error then you have an auto-created .class file.
  • If the compile was successful then to run type:

    Java Basic

  • The following is the output.
Welcome to Basic concept of Java

The following is an example:
 
  1. class BasicConcepts 
  2. {  
  3. public static void main (string[] args)  
  4. {  
  5. System.out.println("Welcome to Basic concept Of Java");  
  6. }  
See this program that has no errors when compiled and run.


Java has more packages like.
  1. import java.util.Scanner;
  2. import java.awt.*;
  3. import java.applet.*;

AWT is the Abstract Window Toolkit.

The following is an example of a packages program:

 
  1. import java.util.Scanner;  
  2. class Oddeven  
  3. {  
  4.       public static void main(String[]args)  
  5.       {  
  6.             int a;  
  7.             System.out.println("Please enter the number ");  
  8.             Scanner in=new Scanner(System.in); //scanner use for input the value of variable  
  9.             a=in.nextInt();  
  10.             if(a%2==0)  
  11.             {   
  12.                   System.out.println("this number is even num");  
  13.             }  
  14.             else  
  15.             {  
  16.                   System.out.println("this number is odd num");  
  17.             }  
  18.       }  
  19. }  
Use the same process of upper for the first Java program for other Java programs and compile and run it.

When you compile the same with the same class name load the .class name file and then you can run using the command only.

java Oddeven //java and class name only.

See the following image with the program and output in “cmd”:

program and output in cmd
  • After run show message 
  • Please enter the number
  • User enter number like 2
  • Show message like
  • this number is even num
  • And again run show message
  • Please enter the number
  • user enter like 5
  • Show message below
  • this number is odd num
So friends this article will help you with "Basic Concepts of Java and Simple Java program Example". The next time I will include some more interesting commands, thank you. I Hope this i helpful for you; enjoy :).

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Why SSC/HSC Students Should Study Technical Drawing?
High school students who are determined to pursue the Engineering profession use lot of their energy in securing good marks in their Board examinations.They also parallely attend preparatory classes at...

Ashok Jain Sir

1 0
0

Class, Object and Methods in JAVA
Lesson-1: Class, Object and Methods of Java can be compared with body, heart and brain. Without these 3 things, Java does not exist. If you Google the above 3 items, you will find many definitions. But...

Statistics
Chapter 2: Measure Of Central Tendency: The numerical value of an observation (also called central value) around which most numerical values of other observations in the data set show a tendency...
P

Anything could be understood, if learned in proper way, and by good coach.
Anything could be understood, if learned in proper way, and by good coach. Every body has there own way and pace of grasping things, so mentor/coach should be in sync (neither too fast nor too slow) with...

X

Looking for Engineering Diploma Tuition Classes?

The best tutors for Engineering Diploma Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take Engineering Diploma Tuition with the Best Tutors

The best Tutors for Engineering Diploma Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more