When I first learned Java, I was using an IDE called “BlueJ.” It had this feature called “Scope Highlighting” which made it very easy to read blocks of code. Now I’ve moved on from BlueJ and began using Eclipse. I’m currently in the process of customizing Eclipse to my liki…
Tag: java
How to crash an Android app programmatically?
I want to test out crash report using acra but the first step is I need to simulate a fatal crash in Android using code. Any idea? Answer Just execute this code: divide by zero Update: Also can try this Create a method, And call this somewhere/buttonClick OR simply throw an uncaught exception Bingo!
What is the criteria to choose between valueOf() and newInstance()?
Suppose I have a class ObjectInfo which contains Object name & Object type as String.(I am just cooking up something for the sake of asking the question.) And If I want to provide a static factory method to creating instances of this class, which of the following two methods is better & why? Basically…
Printing in Java to Label Printer
I am having trouble printing to a label printer. The code below prints 4 “labels” on one (Picture of Label Attached). The code below prints to a brother QL-500 label printer. It prints onto 3.5″ by 1.1″ labels. It would also be great if someone could help me better understand the code.…
How To: Voice Commands into an android application
There are many tutorials online for adding voice recognition to an android app. They are often confusing and the publishers of the coding are never available for questions. I need a basic overview of …
My copy of Eclipse doesn’t know what an object or a String is
I have a copy of Eclipse Indigo on my mac. It was working fine until I imported a project I had made on a different computer. Now I get errors like “The type java.lang.Object cannot be resolved.” and “String cannot be resolved to a type”. Also, the computer I built it on had Java 7, wh…
Storing and searching 4+ million documents [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, …
What are “connecting characters” in Java identifiers?
I am reading for SCJP and I have a question regarding this line: Identifiers must start with a letter, a currency character ($), or a connecting character such as the underscore ( _ ). Identifiers cannot start with a number! It states that a valid identifier name can start with a connecting character such as …
AspectJ pointcut expression match parameter annotations at any position
I’m trying to define a pointcut expression to match methods which contain a parameter annotated with a specific annotation, regardless of what position the parameter is in. In my case I’m looking for the @Constraint annotation. For example: Matching methods: So far I’ve tried the following e…
Javafx Pane vs Region?
According to the documentation, both Region and Pane will resize any resizable child nodes to their preferred size, but will not reposition them. So i can’t see where the differencies between these …