- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
16 Posted Topics
The problem is that, you haveused the if statement , you have mentioned the return statement when tour if statement is satisfied but what will the program return when if condition is false. So, use the else statement with proper return in it.
Solution of you proble is: [code] import java.io.*; public class file { public static void main(String ar[]) { int x=0; try { File file=new File("abc1276.txt"); FileWriter filewriter=new FileWriter(file); BufferedWriter writer=new BufferedWriter(filewriter); for(int i=0;i<10;i++) { x=(int)(Math.random()*10+10); writer.write(" "+x); } writer.close(); } catch(IOException e) { e.printStackTrace(); } try { File file1=new File("abc1276.txt"); …
Please suggest a good book for learning [B]struts[/B]. I am a beginner with struts, So kindly suggest book keeping this thing in mind. Till now I have heard about [CODE]Struts 2 in action[/CODE]. Any information about this book is very helpful. Kindly reply as soon as possible.
You program is not working because you/your teacher have used the wrong syntax for declaring the byte array. It should be like this [code] byte[] b = new byte[255]; [/code] it means declare an array object b of type byte and it can store 255 variables of type byte.
You can use loops to put values into arrays like this [code] for(int i=0;i<10;i++) { salary[i]=sc.nextInt(); } [/code]
While compiling your so called java file you must save it with name of the class in your case it is gradeBookDriver and after seeing your screenshot I found that you are using filename different from the name of your class The actual name of your class is gradeBookDriver and …
primitive integer has range from -2^31 to 2^31-1
You can solve your problem using the format method and restrict your decimal places upto which digit you want. For eg: To restrict to 3 digits use [code] String s=String.format("%.3f",4765.098000); System.out.println(s); [/code] It will give output 4765.098 i.e upto 3 decimal places.
Check this code. Hope this will solve your problem.. [code] import java.io.*; public class ifelse { public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String a; System.out.println("Enter your Level"); a = in.readLine(); if (a.equals("1")) System.out.println("\nYou are Freshman"); else if (a.equals("2")) System.out.println("\nYou are Sophomore"); else if …
You have done a small mistake that you have written imcoming in place of incoming. So, you must first correct this...
Write the problem. and be specific about the problem...
Recently I have made a simple chatting application(in Java). It has two classes one for client and one for server.On compiling it is not giving any error but on running, it is not giving desired result. So, It will be grateful if you come ahead and try out helping me …
Wha6t's the error man, its running perfectly.
I am giving you a code for adding record to a database of student. You can take help from this of how to add record to database and modify it as per your requirement. [code] package com; import java.sql.*; public class Enterdb { public int enter(String fname,String eno,String un,String pw,String …
Got the solution of your problem... Check this code: [code] import java.io.*; import java.util.Scanner; public class Scan { public static void main(String[] args) throws IOException{ int value; System.out.println("Enter any number"); Scanner scan= new Scanner(System.in); value=scan.nextInt(); switch(value){ case 1:System.out.println("One"); break; default:System.out.println("Enter another one"); } } } [/code]
Recently I have made a simple chatting application(in Java). It has two classes one for client and one for server.On compiling it is not giving any error but on running, it is not giving desired result. So, It will be grateful if you come ahead and try out helping me …
The End.
Dupron