What is mixing data types, JAVA Programming

Assignment Help:

What is Mixing Data Types?

As well as merging various operations, you can mix and match various numeric data types on the similar line. The program below uses both ints and doubles, for instance.
class IntAndDouble {

public static void main (String args[]) {

int i = 10;
double x = 2.5;
double k;

System.out.println("i is " + i);
System.out.println("x is " + x);

k = i + x;
System.out.println("i + x is " + k);
k = i * x;
System.out.println("i * x is " + k);
k = i - x;
System.out.println("i - x is " + k);
k = x - i;
System.out.println("x - i is " + k);
k = i / x;
System.out.println("i / x is " + k);
k = x / i;
System.out.println("x / i is " + k);

}

}
This program generates the following output:
% java IntAndDouble
i is 10
x is 2.5
i + x is 12.5
i * x is 25
i - x is 7.5
x - i is -7.5
i / x is 4
x / i is 0.25
%


Related Discussions:- What is mixing data types

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

What is an intelligent system, What is an intelligent system? Intellige...

What is an intelligent system? Intelligent system is a SW programs or SW and HW systems designed to perform complex tasks employing strategies in which mimic some aspect of hum

List down the names of two array techniques available java, List down the n...

List down the names of two array techniques available in JavaScript. The two techniques thata rae available in java script is: 1. sort( ) [sorts elements within alphabetical

Write names of the dos attacks phases, Write names of the DoS attack's phas...

Write names of the DoS attack's phases? DoS (Denail of service): DoS attach has in total 3 kinds of phases and below they are listed: 1. Search 2. Arm 3. Attack

Beam, program for hinged beam

program for hinged beam

Java remote method invocation (RMI) architecture, Java Remote Method Invoca...

Java Remote Method Invocation (RMI): It gives a way for a Java program on one machine to interact with objects residing in different JVMs. The important blocks of the RMI arc

PROBLEM 2, #The objective is to implement a menu-based system for Bank Acco...

#The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

Explain any five buzz words in java, Question 1 Explain any five buzz w...

Question 1 Explain any five buzz words in Java 2 Explain exception classes and also explain common exceptions in java 3 Explain primitive and abstract data type in java

Http 404 error /myproject/controller notfound, Running a sample Java web ap...

Running a sample Java web application from the web get http 404 error

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd