Skip to main content

Java Interviews Question || Freshers 10

                     Java Interviews Question

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

     1. Which language you know very well.
Ans: Sir, I know java language very well.







2.What is Inheritance in java and also types of in 
    inheritance.
Ans: The process of creating a new class extend and 
      implement the  type,property,behavier of
     already existing object in our class that  techniques
      is called a inheritance.
     Actually java support 3- types of in heritance in java.
       A. Single inheritance
       B. Multi-level inheritance
       C. Hierarical inheritance

       Java Does not support 
       D.Hybrid inheritance
       E.Multiple inheritance








3. Why java not support multiple in Heritance.
Ans: suppose you have a one class . this class extending the two other class . two other class
     having the same signature of method. so, java confused which class method i am going 
      to execute that's why java does't support multiple inheritance.
      if you try to do like that. than you have to go for interface .
      otherwise you got Ambigus problam in java.
      




4.Can you Write a program to find the Palindrome number.
Ans: yes sir,

      import java.util.Scanner;
class Palindrome 
{
 public static void main(String[] args) 
 {
  Scanner sc=new Scanner(System.in);
  System.out.println("Enter the Number:");
  int n=sc.nextInt();
  int m=n;
  int sum=0;
  int rem=0;
  while(n!=0){
          rem=n%10;
    sum=sum*10+rem;
    n=n/10;
  }
  if(sum==m)
    System.out.println("Palindrome Number");
  else
   System.out.println("Not palindrome Number");
 }
}





5.What is the used of super and this keyword in java.
Ans: Super keyword is used to access the super class member
     and this keyword used to access the current class members in java.





6.What is Encapsulation in java.
Ans: The process to binding the Data member and member function in one unit and provide 
     the access data member with the help of method that is called the Encapsulation.
     
      For Example- create all Data member in the class with private
        and create the setter and getter method that is called Encapsulation.





7.You know collection .Waht is the used of ArrayList
Ans: yes sir.
     The used of arraylist is storing the collection of object Hectrogenious,homogineous
     unique, duplicate in java.
     You can access the values in the ArrayList very easily. it will provide the indexing.
     also storing the object in inserction order.
     It is not thread shafe so, multiple Thread can access the same object and modify the
     values in ArrayList at time.

       ArrayListarr=new ArrayList<>();






8.What is method overloading in java.
Ans: If we create multiple method with same name but different parameter,order and type
      that is called the method overloading in java.
      Method overloading can be possible in one class and super & subclass also.









9.Why Object is super class of all the classes.
Ans: Actually Object having the common property of all the sub classes and object.
      that's why sun microsystem define this Object class  is by default super class of 
      all the classes.
      Object class having a all method used for subclass.
      Common to all object method is avilable in the super class Object.






10.What is the used of LinkList in java.  
    

Comments

Popular posts from this blog

How to Send OTP in Mobile Number | login with OTP mobile Number | How to send OTP in mobile no with Spring Boot APP

   ðŸ˜‚               Login with Mobile Number OTP ---------------------------------------------------------------------------- If you want to develop a project to log in with OTP mobile Number in Spring Boot Applications then this post for you. In this post, I am going to use some other service to send the OTP in mobile number. we have to use it in this project spring boot. we are going to use Twilio to send SMS. we are going to use a web socket to send the data from the browser to the SMS gateway. Oracle Database for store the user details. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <version>2.3.3.RELEASE</version> </dependency> <dependency> <groupId>com.twilio.sdk</grou

Spring Boot With MySQL Database connection with Examples | MySQl Database Configuration with Spring Boot Projects

 ðŸ˜ƒ MySQL Database Configuration with Spring Boot Projects  In this article, we are going to introduce How to connect MySQL Database with the Spring Boot project. pom.xml   <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</gro

How can we create Auto generated field or ID for mongodb using spring boot

😂 How can we create an Auto-generated field or ID for MongoDB using spring boot? First Create One Application Like Mongodb_sequence-id-generator Pom.XML <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> </dependency> User.java package com.app; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users_db") public class User { @Transient public static final String SEQUENCE_NAME = &