72 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for ogsirus

Hi Guys I ran into a bit of a problem with some code I am writing. I am trying to store all possible combinations of a set of numbers which are current being stored in List. Problem is my code run into an out of memory exception, heres my code: …

Member Avatar for ogsirus
0
2K
Member Avatar for achava

As part of a class in Java, the constuctor is supposed to throw a java.lang.IllegalArgumentException exception when an integer that is a field in the class, let's call it int N, is set to a negative vale. How do I set this up?

Member Avatar for achava
0
215
Member Avatar for moaz.amin.37

hello i am doing my assignment on simple calculator in java.Now I want to handle exceptions in it. so i need some information about exception for exemple a user enter any expression like `(10+23+56-55)` it is corrent formate but when the user enter wrong formate like `(20++56//5)` i mean operator …

Member Avatar for BenWard
0
408
Member Avatar for moaz.amin.37

Exception message is not showing import java.util.*; class WrongException extends Exception{ public WrongException(String s){ super(s); } } public class UserDefinedException2{ public static void main(String s[]){ int a,b; a=b=0; Scanner ob=new Scanner(System.in); System.out.print("Enter your age = "); a=ob.nextInt(); try { if(a<=0) throw new WrongException("age cannot be zero or nagetive"); System.out.print("age = …

Member Avatar for Akansha Jain
0
2K
Member Avatar for moaz.amin.37

if a program throw 2 exceptions can we handled it by user defined exception.for example import java.util.*; class WrongException extends Exception{ public WrongException(String s){ super(s); } } public class UserDefinedException2{ public static void main(String s[]){ int a,b; a=b=0; Scanner ob=new Scanner(System.in); System.out.print("Enter your age = "); a=ob.nextInt(); try { if(a<=0) …

Member Avatar for JamesCherrill
0
251
Member Avatar for moaz.amin.37

Following exceptions are `Checked Exception` or `Unchecked Exception` ArrayStoreException IllegalArgumentException

Member Avatar for JamesCherrill
0
284
Member Avatar for moaz.amin.37

exception is a run time error,then why exceptions are again classified into compile time exception and run time exception,in that case it should be run time exceptions only.please give explanation with suitable real time example

Member Avatar for moaz.amin.37
-1
329
Member Avatar for Riteman

I recently developed an application and it successfully ran in my computer where I developed. But when I tried to run in my client's system, it returns: An unhandled microsoft .net framework exception occurred in Members Manager.exe [2916] The number in the square braces appears randomly. I can't figure out …

Member Avatar for Riteman
0
263
Member Avatar for admiri92

Are exceptions standardized in C++? I mean if the rules of exception handling might be changed in the future. i.e: int Funct1(int) throw(); // does it throw an exception?

Member Avatar for mike_2000_17
0
284
Member Avatar for simran_4

Hello all, I am stuck with a nullpointerException at line 41 and 60.Can someone please help me out.any kind of help will be appreciated. Thanks import javax.swing.*; import javax.swing.event.*; import java.awt.Color; import java.awt.*; class calenders extends JFrame { int i=0; int j=0; int k=0; JFrame jf; FlowLayout fl; JPanel jp[]; …

Member Avatar for simran_4
0
557
Member Avatar for Louie_Rave

Hello. I uhh... I just want a sample code for the Exceptions: SecurityException and StackOverflowException. I'm still new to handling exceptions. Please, just a sample code that is about those two will do.

Member Avatar for |-|x
0
207
Member Avatar for |-|x

Hi All I have googled this exception extensively, and all the discussions I've found seem to be related to file uploading and exceeding the allowed file size limit. In my case however, I am not uploading anything, it is a simple postback. I have a gridview displaying the results of …

Member Avatar for BMXDad
0
1K
Member Avatar for STP_Captain_Slo

Hi I have a set of Checkboxes each with a Textbox next it to. I have the following code, which is meant to loop through each CheckBoxe and if checked if gets the text contained in the textbox, these are linked through the tag of the checkbox, i have used …

Member Avatar for rathideva
0
2K
Member Avatar for mesbahuk

I have been working on a conversion project for last few days where I need to convert a Java library to C#. At one point I came to java's certain feature called [Exceptions Thrown by a Method](http://docs.oracle.com/javase/tutorial/essential/exceptions/declaring.html). Here is a little glimpse of it: public boolean isRequest() throws NullPointerException { …

Member Avatar for Ketsuekiame
0
303
Member Avatar for pwolf

whats wrong with this code? It keeps giving me an "unreachable code detected " exception public static int search(string Registration) { // this method will search for registration, if found it will return the index value , else it will return max value + 1 for (int x = 0; …

Member Avatar for ndeniche
0
255
Member Avatar for de Source

hi, i have a drop down list populated with column names of tbl_student and a text box for searching specific value coresponding to the value selected in drop down list i do not have much knowlewdge about qureies might b m lacking there error is Incorrect syntax near '=' my …

Member Avatar for de Source
0
833
Member Avatar for joshl_1995

Hello Community, I was wondering if there is a way to goto the direct link of a file (eg. http://example.com/files/test.txt) and for it to download insted of loading and displaying the file. I want to do this for every file in the "files" folder and only that folder.

Member Avatar for joshl_1995
0
205
Member Avatar for ProgramGuy

Hey everyone! Happy New Year! I am trying to hone my programming skills by writing simple applications. I created a very simple currency converter program (hard-coded exchange rates....so nothing special). I first created it as a console app, and then in WPF. Anyway, I ran into an issue with the …

Member Avatar for ProgramGuy
0
733
Member Avatar for //Gonz

Hello all I am writing a solicitor allocation application that will be used by multiple users at one time. Because of this, the database needs to be updated with every change. This is my code when a solicitor is chosen for allocation: private void FindSolicitor(int type, bool stype) { table …

Member Avatar for //Gonz
0
284
Member Avatar for rahul.ch

Given: Sour extends Blue extends Pan `Pan p4 = new Sour();` Then set of 6 new statements given and asked to choose which ones will compile. They are: 1. `Pan p5 = p4;` 2. `Pan p6 = (Blue)p4;` 3. `Blue b2 = (Blue)b4;` 4. `Blue b3 = (Sour)p4;` 5. `Sour …

Member Avatar for JamesCherrill
0
196
Member Avatar for rahul.ch

import java.io.*; public class Mac extends Laptop { public static void main(String r[]) { new Mac().crunch(); } //insert code here } class Laptop { void crunch() throws IOException { } } The question is simple. Insert a code that will make the program compile. Answers are: `void crunch()` or `void …

Member Avatar for NormR1
0
212
Member Avatar for cmstoner

Hi all, In the program I'm working on, I am making a form that submits data to an Access 2007 database. I can connect to the database fine and run a select query, but when I try an insert query I get an error: "statement contains the following unknown field …

Member Avatar for kRod
0
278
Member Avatar for rahul.ch

Is it mandatory to handle an exception that is thrown using the `throw` keyword? If so is there a separate rule for Checked and Unchecked Exception, as in who should be mandatorily caught? public void met() { throw new ArithmeticException

Member Avatar for stultuske
0
170
Member Avatar for rahul.ch

Compiles fine. But at runtime it gives ClassCastException. My doubt is that why is it so even though st which is of type Sample1 gets casted to Sample2 and generates exception even though Sample2 IS-A Sample1.

Member Avatar for rahul.ch
0
242
Member Avatar for 2concussions

i am just trying to populate this array with some information. i have no idea why, but i am getting: java.lang.ArrayIndexOutOfBoundsException: 0 im probably just stupid 0_o... but, here is my code: private boolean populated = false; private int blockList[][] = {}; public void update(){ if(populated == false){ int a …

Member Avatar for NormR1
0
293
Member Avatar for trishtren

Hey, iv been working on a fairly simple part of my program but it throws a null pointer exception. The error i recieve is : Exception in thread "main" java.lang.NullPointerException at FillStyle.<init>(FillStyle.java:12) at compiler.main(Builder.java:43 The code causing the error is : public FillStyle(int type) { if (type >= 0) { …

Member Avatar for trishtren
0
276
Member Avatar for belenos46

I'm trying to write a string out to a file using File.AppendAllText, but I need to do it several times over the course of the program. I'm not using threading, and to give the file time to close, I'm letting my program sleep for a couple of seconds after it …

Member Avatar for belenos46
0
757
Member Avatar for deshazer.jad

I'm trying to load a PNG file into a BufferedImage like so: BufferedImage image = ImageIO.read(new File("smile.png")); When I use this line of code alone, it produes the error: Unhandled Exception Type IOException... I can fix this by surrounding the statement with try/catch like so: BufferedImage image = null; try …

Member Avatar for deshazer.jad
0
821
Member Avatar for baig772

i am new to android. While i am running my application, it is running well in landscape mode, but in portrait mode, application is forcefully closed giving the following in log 05-31 16:48:30.958: W/KeyCharacterMap(428): No keyboard for id 0 05-31 16:48:30.958: W/KeyCharacterMap(428): Using default keymap: /system/usr/keychars/qwerty.kcm.bin 05-31 16:50:45.728: D/AndroidRuntime(484): Shutting …

Member Avatar for baig772
0
182
Member Avatar for nidheeshkumar.r

hey, im getting the exception [CODE]Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com.sun.media.jai.codec.SeekableStream at javax.media.jai.operator.BMPDescriptor.class$(BMPDescriptor.java:65) at javax.media.jai.operator.BMPDescriptor.<clinit>(BMPDescriptor.java:87) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:186) at javax.media.jai.RegistryFileParser.getInstance(RegistryFileParser.java:224) at javax.media.jai.RegistryFileParser.registerDescriptor(RegistryFileParser.java:360) at javax.media.jai.RegistryFileParser.parseFile(RegistryFileParser.java:295) at javax.media.jai.RegistryFileParser.loadOperationRegistry(RegistryFileParser.java:55) at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:369) at javax.media.jai.JAI.<clinit>(JAI.java:382) at cbir.window1.ColorHistogram.<init>(ColorHistogram.java:61) at cbir.window1.SearchWindow.jButton1ActionPerformed(SearchWindow.java:92) at cbir.window1.SearchWindow.access$000(SearchWindow.java:22) at cbir.window1.SearchWindow$1.actionPerformed(SearchWindow.java:47) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) …

Member Avatar for nidheeshkumar.r
0
425

The End.