Recently Added Questions & Answers

 

Advantage of direct shear test  

  1. The direct shear test is a simple test and relatively fast especially for granular soils .
  2. The basic principle is easily understood which can be extended to gravelly soils and other materials containing large particles. 
  3. The apparatus is relatively cheap.
  4. It is not difficult to prepare recompacted test samples. 

Limitations of direct shear test 

  1. It is difficult to control the drainage conditions if an undrained test is conducted.
  2. The stress conditions across the soil samples are very complex. 
  3. The plane of shear failure is predetermined and may not necessarily be the weakest one.
  4. There is an effect of lateral restraint by the side walls of the shear box.
 

No, we cannot define a static constructor in Java, If we are trying to define a constructor with the static keyword a compile-time error will occur.

In general, static means class level. A constructor will be used to assign initial values for the instance variables. Both static and constructor are different and opposite to each other. We need to assign initial values for an instance variable we can use a constructor. We need to assign static variables we can use Static Blocks.

 

Example :-

public class StaticConstructorTest {
   int x = 10;
   // Declaratiopn of Static Constructor
   static StaticConstructorTest() {
      System.out.println("Static Constructor");
   }
   public static void main(String args[]) {
      StaticConstructorTest sct = new StaticConstructorTest();
   }
}

In the above example, we have created a static constructor. the  code doesn't compile and it can throw an error says that modifier static not allowed here.

Output

StaticConstructorTest.java:4: error: modifier static not allowed here
 

No, you cannot call a constructor from a method. The only place from which you can invoke constructors using “this()” or, “super()” is the first line of another constructor. If you try to invoke constructors explicitly elsewhere, a compile time error will be generated.

Example :-

import java.util.Scanner;
public class Student {
   private String name;
   private int age;
   Student(){}
   Student(String name, int age){
      this.name = name;
      this.age = age;
   }
   public void SetValues(String name, int age){
      this(name, age);
   }
   public void display() {
      System.out.println("name: "+this.name);
      System.out.println("age: "+this.age);
   }
   public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the name of the student: ");
      String name = sc.nextLine();
      System.out.println("Enter the age of the student: ");
      int age = sc.nextInt();
      Student obj = new Student();
      obj.SetValues(name, age);
      obj.display();
   }
}

Compile time error :-

Student.java:12: error: call to this must be first statement in constructor
   this(name, age);
^
1 error
 

Class/static variables belong to a class, just like instance variables they are declared within a class, outside any method, but, with the static keyword.

They are available to access at the compile time, you can access them before/without instantiating the class, there is only one copy of the static field available throughout the class i.e. the value of the static field will be same in all objects. You can define a static field using the static keyword.

If you declare a static variable in a class, if you haven’t initialized it, just like with instance variables compiler initializes these with default values in the default constructor.

Yes, you can also initialize these values using the constructor.

Example :-

public class DefaultExample {
   static String name;
   static int age;
   DefaultExample() {
      name = "Krishna";
      age = 25;
   }
   public static void main(String args[]) {
      new DefaultExample();
      System.out.println(DefaultExample.name); System.out.println(DefaultExample.age);
   }
}

Output :-

Krishna
25
 

==>  hashing--

  • Hashing is the process of transforming any given key or a string of characters into another value
  • This is usually represented by a shorter, fixed-length value or key that represents and makes it easier to find or employ the original string. 

Jump to Page : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

Recommended Question Bank

General - Computer Science
View
- Computer organisation and architecture
View
NA - Java
View
- javascript
View
- STORAGE AREA NETWORKS
View
Mejona - Mejona Technology
View
VTU - NCES(Non - Conventional Energy Resources
View
- Java Basic Codes
View
VTU - STORAGE AREA NETWORK
View
- HIGHWAY ENGINEERING
View
- COMPUTER ORGANIZATION
View
- Quantity Surveying and Contracts Management
View
- Design of RC Structural Elements
View
- Ground Water and Hydraulic
View
- Urban Transport Planning
View
- Basic Geotechnical Engineering
View
VTU - Municipal Waste Water Engineering
View
VTU - Design of Steel Structures Elements
View
- Interview Question Bank
View
VTU - Artificial Intelligence
View
Visvesvaraya Technological University (VTU) - Ground water hydraulic
View
-
View
VTU - Artificial intelligence and Machine Learning (AIML)
View
VTU - Energy and Environment
View
VTU - User Interface Design
View
- Data Structures and Algorithms
View
VTU - Big Data Analytics
View
VTU - Engineering Chemistry
View
VTU - User Interface Design (UID)
View
Entrance Exam for job - Entrance Exam Questions
View
VTU - Elements of Civil Engineering and Mechanic
View
VTU - Computer Graphics and Visualization
View
VTU - Object Oriented Concepts
View
VTU - System Software and Compiler Design
View
VTU - Web Technology and its Applications
View
VTU - Cloud Computing and Its Applications
View