Answer to Question #262144 in Java | JSP | JSF for طالب

Question #262144

Q2/ Java Data Types Assignment?


Object [ ] = { “Java”, 1.23F, true, false, 23, ‘a’, ‘b’,


23.4F, 45.6F}; Write the Java Program to sum only the


float variables or any data type.

1
Expert's answer
2021-11-07T01:57:18-0400
{
	public static void main(String[] args) {
	   String Object[]  = { "Java", "1.23F", "true", "false", "23", "a", "b","23.4F", "45.6F"};
	  double obj[]={1.23,23.4,45.6};
	    double sum=obj[0]+obj[1]+obj[2];
		System.out.println("Sum of float variables is: "+sum);
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS