IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to Take input in java ?. Specially character input..

2 posters

Go down

Java How to Take input in java ?. Specially character input..

Post by BIT0305-tanvir Thu Sep 29, 2011 4:39 am

How to take character input in java ?
and as well as other(String,int,double) too..

How much way of scanning do we have ?

and 1 more question, how can i traverse string ? I mean how can i find a single character in String....? How to Take input in java ?. Specially character input.. 332205

BIT0305-tanvir
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • N/A

Blood Group : NULL
Posts : 7
Points : 10

Back to top Go down

Java Re: How to Take input in java ?. Specially character input..

Post by BIT0122-Amit Thu Sep 29, 2011 4:50 am

Very Happy তোমার মাথা ঠুকাঠুকি দেখে সেরাম মজা পাইছি।

এটা উপায় ১-
Code:
   char c = ' ';
      try {
         c = (char) System.in.read();
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      System.out.println(c);

এটা উপায় ২-
Code:
      Scanner s = new Scanner(System.in);
      char c;
      c = s.next().charAt(0);
      System.out.println(c);

আর int, double এর জন্য তো scanner এর nextInt(), nextDouble() আছেই!

traverse এর জন্য indexOf method টা ব্যবহার করতে পারো-

Code:

      String temp = "Hello World";
      
      System.out.println(temp.indexOf('W'));

আমার মনে হয় তুমি eclipse এ javadoc টা পড়লে অনেক তাড়াতাড়ি শিখতে পারবে এসব Smile

জানাবে এসব বুঝেছ নাকি। try catch টা বুঝার এখনই দরকার নাই অবশ্য :p
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Java Re: How to Take input in java ?. Specially character input..

Post by BIT0305-tanvir Thu Sep 29, 2011 10:52 pm

হুম...নিচের ২ টা বুজসি । উপরের টা বুঝি নাই ।। java doc ki??

BIT0305-tanvir
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • N/A

Blood Group : NULL
Posts : 7
Points : 10

Back to top Go down

Java Re: How to Take input in java ?. Specially character input..

Post by BIT0122-Amit Fri Sep 30, 2011 12:03 am

javadoc = java documentation.
ওটা থাকলে কোড করার সময় কোন function এর কি কাজ, সেটায় কি কি argument দিতে হয়, বা কি return পাওয়া যায় সব দেখা যায়।
তুমি কি jdk install করেছো নাকি jre?
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Java Re: How to Take input in java ?. Specially character input..

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum