Sunday, September 3, 2017

Java - Integer Class

Source Link:
https://www.tutorialspoint.com/java/lang/java_lang_integer.htm

Some Useful Method:

static int parseInt(String s)
This method parses the string argument as a signed decimal integer.

String toString() 
This method returns a String object representing this Integer's value. 

Example: 
package com.tutorialspoint; 
import java.lang.*; 
public class IntegerDemo { 
 public static void main(String[] args) {
       // parses the string argument
      int a = Integer.parseInt("12");
      int b = Integer.parseInt("26");
      int c = Integer.parseInt("54");
      int m = a * b * c;
      System.out.print("Value after multiplying = " + m);
   }
} 
Let us compile and run the above program, this will produce the following result −
Value after multiplying = 16848

No comments:

Post a Comment

Codility - Lesson 16 Greedy algorithms - 2. MaxNonoverlappingSegments

Source Link: https://app.codility.com/programmers/lessons/16-greedy_algorithms/max_nonoverlapping_segments/ Question: Located on a line ...