Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Default Constructor

class Main {

  int a;
  boolean b;
  byte c;
  short d;
  long e;
  char f;
  float g;

  public static void main(String[] args) {

    // A default constructor is called
    Main obj = new Main();

    System.out.println("Default Value:");
    System.out.println("int = " + obj.a);
    System.out.println("boolean = " + obj.b);
    System.out.println("byte = " + obj.c);
    System.out.println("short = " + obj.d);
    System.out.println("long = " + obj.e);
    System.out.println("char = " + obj.f);
    System.out.println("float = " + obj.g);
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: basics of java 
Java :: java comparator comparing 
Java :: how to set default focus on edittext in android 
Java :: use custom font java 
Java :: how to remove leading space in java 
Java :: one key with multiple values map java 
Java :: Error: Could not find or load main class Hello Caused by: java.lang.ClassNotFoundException: Hello studio visual code 
Java :: runtime exception in java 
Java :: variable might not have been initialized error 
Java :: extends class in java 
Java :: authentication in spring boot 
Java :: java pass by reference 
Java :: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. 
Java :: focusbutton 
Java :: Java try...finally block 
Java :: Java public no-arg constructor 
Java :: getsmallestnumber 
Java :: method object class in android 
Java :: rotate vector 3d java 
Java :: android system navigation back bar hide 
Java :: full screen in libgdx Lwjgl3 
Java :: java load configuration log 
Java :: format string precision double java 
Java :: Show the difference between this() and super() with help of a code 
Java :: what does .set do in java 
Java :: Composite foreign keys as primary key jpa 
Java :: how-to-use-volley-string-request-in-android 
Java :: how is boolean array initialized if no input is given java 
Java :: for-each Loop Sytnax JAVA 
Java :: isblank vs isempty java string utils 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =