Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to change datatypes in java

public class Main {
  public static void main(String[] args) {
    int myInt = 9;
    double myDouble = myInt; // Automatic casting: int to double

    System.out.println(myInt);      // Outputs 9
    System.out.println(myDouble);   // Outputs 9.0
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java interview questions 
Java :: array of arraylist in java 
Java :: spring boot example with swagger 
Java :: linear serach in java 
Java :: how to use iterator in java 
Java :: get distinct values from list of objects java 
Java :: how to multiply a number by itself using for loop in java 
Java :: how to skip a line with a filewriter java 
Java :: set web image to imageview android java 
Java :: java add constructor to enum 
Java :: string to char array 
Java :: array index out of bound exception in java 
Java :: list interface java 
Java :: java code for logarithm 
Java :: list remove duplicates java 
Java :: generate hash in java 
Java :: import string java 
Java :: java comparator comparing 
Java :: java constructor example 
Java :: what is return method 
Java :: java literals 
Java :: java convert int to string 
Java :: " meaning in java 
Java :: Print Positives of array 
Java :: getsmallestnumber 
Java :: jbutton actionperformed 
Java :: Printing Hexadecimal Code 
Java :: how to accept only numbers and whitespace in java 
Java :: how can you make a void method that transfer money from one account to the other on java 
Java :: java try-with-resources nested streams 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =