What is java

What is java
What is java Java is a computer programming language. It enables programmers to write computer instructions using English based commands, instead of having to write in numeric codes. It’s known as a “high-level” language because it can be read and written easily by humans. Like English, Java has a set of rules that determine how the instructions are written. These rules are known as its syntax. Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute.
In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javaccompiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The javalauncher tool then runs your application with an instance of the Java Virtual Machine.


 Figure showing MyProgram.java, compiler, MyProgram.class, Java VM, and My Program running on a computer.
Because the Java VM is available on many different operating systems, the same .class  files are capable of running on Microsoft Windows, the Solaris™ Operating System (Solaris OS), Linux, or Mac OS. Some virtual machines, such as the java SE HotSpot at a Glance perform additional steps at runtime to give your application a performance boost. This includes various tasks such as finding performance bottlenecks and recompiling (to native code) frequently used sections of code

Share:

11 comments:

  1. is it spring bean is thread safe or not

    ReplyDelete
    Replies
    1. Spring Beans are not thread safe because. we can declere the beans in different scopes

      thats why spring beans are not thread safe

      Example: suppose i have declare bean as singleton at that time only one object is created and i have declare bean asa prototype at that time for each and every request superate object is created thats why we can say Spring bean is not thread safe

      Delete
    2. How do you do sorting of user defined objects in Java?Give one example?

      Delete
    3. package com.opps;

      import java.util.ArrayList;
      import java.util.Collections;
      import java.util.List;

      public class UserDefinedObjectSorting {
      public static void main(String[] args) {

      List list = new ArrayList();
      list.add(new Person("srinu",24));
      list.add(new Person("rama",29));
      list.add(new Person("krishna",30));
      list.add(new Person("suresh",4));
      list.add(new Person("hari",14));
      for (Person person : list) {
      System.out.println(person.getName()+ " "+ person.getAge());
      }
      Collections.sort(list,new PersonComparator());
      System.out.println("After sorting");
      for (Person person : list) {
      System.out.println(person.getName()+ " "+ person.getAge());
      }
      }
      }


      ================

      package com.opps;

      import java.util.Comparator;

      public class Person {

      private int age;
      private String name;

      Person (String name, int age){
      setName(name);
      setAge(age);
      }

      public int getAge() {
      return age;
      }

      public void setAge(int age) {
      this.age = age;
      }

      public String getName() {
      return name;
      }

      public void setName(String name) {
      this.name = name;
      }



      }
      =================

      package com.opps;

      import java.util.Comparator;


      public class PersonComparator implements Comparator {

      @Override
      public int compare(Person obj1, Person obj2) {
      return obj1.getAge() - obj2.getAge();
      }
      }

      Delete
  2. If an Array contains duplicate values like 1 2 2 5 6 3 3 7 7.
    How can you remove that duplicates?

    ReplyDelete
    Replies
    1. import java.util.*;


      public class RemoveDuplicates {
      public static void main(String args[])
      {

      ArrayList arrayList=new ArrayList();
      arrayList.add(1);
      arrayList.add(2);
      arrayList.add(2);
      arrayList.add(6);
      arrayList.add(3);
      arrayList.add(3);
      arrayList.add(7);
      arrayList.add(7);

      System.out.println(arrayList);
      Set set=new HashSet(arrayList);

      System.out.println(set);

      }}

      Delete
    2. Basically ArrayList allows duplicate values but in collection we have Set interface it doesnot allow duplicate values

      in this case i have created ArrayList and i have added duplicate values to the arraylist and i created Set and i have passed ArrayList object through HashSet class
      That means set elliminate duplicate values
      finally we will get without duplicate values

      Delete
    3. OutPut:

      Before Deleting Duplicate Values
      [1, 2, 2, 6, 3, 3, 7, 7]
      After Deleting Duplicate Values
      [1, 2, 3, 6, 7]

      Delete
  3. package com.opps;

    public class RemovingDuplicatesFromArray {
    public static void main(String[] args)
    {
    int a[]={3,2,1,4,2,1};
    System.out.print("Before Sorting:");
    for (int i=0;ia[j])
    {
    int temp=a[i];
    a[i]=a[j];
    a[j]=temp;
    }

    }
    }

    //After sorting
    for(int i=0;i<a.length;i++)
    {
    System.out.print(a[i]+"\t");
    }
    System.out.print("\nAfter removing duplicates:");
    int b=0;
    a[b]=a[0];
    for(int i=0;i<a.length;i++)
    {
    if (a[b]!=a[i])
    {
    b++;
    a[b]=a[i];
    }
    }
    for (int i=0;i<=b;i++ )
    {
    System.out.print(a[i]+"\t");
    }
    }
    }

    ReplyDelete
  4. what is connection pool
    The connection pool within a JDBC data source contains a group of JDBC connections that applications reserve, use, and then return to the pool. The connection pool and the connections within it are created when the connection pool is registered, usually when starting up WebLogic Server or when deploying the data source to a new target.

    ReplyDelete

Ordered List

Popular Posts

The Magazine

Facebook

Post Top Ad

LightBlog

Post Top Ad

Your Ad Spot

About Me

authorHello, my name is Jack Sparrow. I'm a 50 year old self-employed Pirate from the Caribbean.
Learn More →

Comment

Post Top Ad

Your Ad Spot

Hot

AD BANNER

Sponsor

AD BANNER

Recent Comments

Extra Ads

AD BANNER

Contact Form

Name

Email *

Message *

Translate

Sponsor

test

Home Top Ad

Responsive Ads Here

Flickr

Ad Banner
Responsive Ads Here

About Us

authorHello, my name is Jack Sparrow. I'm a 50 year old self-employed Pirate from the Caribbean.
Learn More →

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Sample Text

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation test link ullamco laboris nisi ut aliquip ex ea commodo consequat.

Pages

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.