Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

int primitive

Bharat's picture

Java Vector int

Hi All,

I have a int variable which I would like to add to Vector object. Any example on how to add int to Vector object?

Thanks in advance.
0
Your rating: None
Ramasubramaniam's picture

Convert char to int ASCII example

0
Your rating: None
  1. /*
  2.  * Convert char to int ASCII example. Program to convert char
  3.  * to int ASCII number.
  4.  */
  5.  
  6. public class CharToInt {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   char ch = 'a';
  11.    
  12.   //cast the character to convert it to int
  13.   int asciiCode = (int)ch;
  14.    
  15.   System.out.println("char converted to int ascii code: " + asciiCode);
  16.  
  17.  }
  18.  
  19. }
Rahimv's picture

Convert String to primitive int example

5
Your rating: None Average: 5 (1 vote)
  1. /*
  2.  * Convert String to primitive int example. Program to convert Java
  3.  * String object to primitive int data type.
  4.  */
  5.  
  6. public class StringToInt {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   //new String object
  11.   String str = new String("342");
  12.  
  13.   /*
  14.    * To convert String to primitive int data type, use
  15.    * parseInt(String) static method of Integer class
Rahimv's picture

Convert Integer to primitive int example

2
Your rating: None Average: 2 (2 votes)
  1. /*
  2.  * Convert Integer to primitive int example.
Syndicate content