Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

0
votes
0answers
5 views

Query on java I/O BufferedOutputStream write() method

Below is the code that is written using byte stream non-buffer class FileInputStream and FileOutputStream with the usage of explicit user buffers. public class FileCopyUserBuffer{ public static ...
0
votes
0answers
11 views

Shortest path to visit all nodes

I am given a set of tourist attractions(nodes identified by x, y) and i need to find the shortest path to visit them. The way i thought of it, is i will ignore if there are streets available and ...
1
vote
1answer
18 views

Template pattern with varying input type in overridden method

I am trying to use template pattern to define a generic algorithm in java. But the method that needs to be overridden, takes an object as input. This object will vary depending on the concrete ...
0
votes
1answer
59 views

Whats the difference between byte and Byte?

Alright so of course, I know the differences. byte is a primitive and Byte is an object. Byte offers more functions but there is one thing I dont understand. Why would anyone create a variable using ...
-5
votes
0answers
11 views

Simple Reversi realization in Java

Where can I get simple Reversi board game realization in Java for educational purpose? I found only very hard implementations. That is not good.
-1
votes
0answers
41 views

Is it worth it to learn Swing? [on hold]

I'm a computer science student (2nd year), and in my university, they teach us java but they do not teach us how to make GUI's wich Java. Here, they say that Java Swing is slow and useless to learn. ...
1
vote
1answer
114 views

Why is close() implemented in InputStream/OutputStream?

It make sense to see close() as non-core functionality of stream objects. This is the reason this method is placed in interface Closeable. One evidence is that class ByteArrayInputStream does not ...
1
vote
2answers
50 views

Query on hiding implementation details in java

With the below piece of thread related code, I see that author of Thread class is hiding the details about the working of start() method. What a user of Thread class need to know is, class Thread ...
0
votes
0answers
19 views

vert.x message bus architecture

A large part of the vert.x architecture is around the message bus, and message passing between verticals. The main idea I guess being that I can create multiple modules (possibly in multiple ...
-1
votes
1answer
55 views

Thinking in Java 4th edition - How to read efficiently? [on hold]

a) Is there anyone who could give me some tips how to read Bruce Eckel's book efficiently? So far I read 230 pages of Eckel's book in 19 days (i made all the exercises, coded alot) - i went trough ...
-1
votes
2answers
65 views

Initialize in Field, Constructor, or Argument

If I know what a field will be initialized to, should I initialize it in the field, constructor, or receive it as a parameter? For example, where should I initialize an ArrayList? Initialized in ...
-4
votes
0answers
51 views

Where do programmers look for reference/documentation about Java's features/libraries/functions? [on hold]

Rookie programmers learning the language usually use a book or online materials.They are introduced to the language's syntax, common used functions for text processing or math operations. Only a small ...
2
votes
2answers
235 views

Unit testing and reality [on hold]

I m actually studying Unit testing, reading some articles on the internet and trying to understand how it works exactly, but it's not very clear for me actually. What should I test ? I have seen ...
-4
votes
0answers
32 views

can someone explain me what does a <enum class>.values() functions actually do? [on hold]

I used a values() method in an enhanced for loop to traverse all values in my enum class. But what does this method actually do?
-3
votes
0answers
30 views

Java 1.6 on Eclipse: What does ERROR “annotation must be explicitly requested,” mean when creating new classes? [on hold]

I've copied code from a YouTube tutorial and for some reason the program terminates but it never renders the window. I've included Eclipse in firewall exceptions on Mac, I'm sure my system currently ...
0
votes
2answers
97 views

What design pattern for changing interface?

Say I have the abstract class Father, and three(or more) of his children class Son1, Son2 and Son3. Now I have to change one method, in other words, add an argument to one method of Father. However, I ...
-6
votes
0answers
21 views

Link's massive in webdriver [on hold]

I want create script where the 1st step is to open a website and the 4th step is to click on a button. The button I want to take is from massive. I'm getting an exception. Can you help me or give me ...
-2
votes
0answers
50 views

transitioning from C# to Java. [on hold]

I have spent the last five years programming in C#/.net and have been transferred to a Java team. What are some of the things I need to watch out for? What are some of the more enjoyable things I ...
-4
votes
0answers
34 views

Any birdview article about Web development with Java? [on hold]

I am new to Java Web development. And I am tasked to create a prototype with Java and related technologies in a short time. So I am looking for some birdview article about the Web development ...
2
votes
1answer
121 views

Why use a enum to create the singleton pattern [duplicate]

Why would you use an enum to create a singleton pattern? To what purpose would it serve over a conventional singleton pattern? I have seen the above used. The code uses an enum to create this pattern ...
2
votes
1answer
30 views

Applying initialization-on-demand holder idiom at variable level rather than class

I was looking for the idiomatic way to implement thread-safe lazy initialization for a configuration collection retrieved from the DB inside a Spring bean. I decided to adapt the ...
-3
votes
3answers
71 views

Simple project ideas [on hold]

I am looking for simple project ideas to help teach some of my fellow students. I am trying to team them the following: -If / else if / else -For and while loops -Logical AND / OR -creating ...
-2
votes
2answers
100 views

What is a good name for a class that interacts with a command line tool? [on hold]

I'm writing a program in Java that includes a component that will interact with command line tool. In particular, I want to automatically process some data from an open-source GitHub project, so one ...
0
votes
1answer
67 views

Continuous Integration for different languages [on hold]

So, I understand Continuous Integration in theory, and have used Beanstalk. However, I've been charged with creating the process at my current PHP shop. My hope was maybe PHPCI, since it looked ...
4
votes
2answers
213 views

Is it better to use strings or int to reference enums outside the java part of the system?

We were having a discussion at my work about the use of enums in Java. A coworker was arguing that when using enums on the server-side, whenever required we should use string to reference to it (for ...
0
votes
0answers
3 views

Cannot find bug in NegaMax implementation for java chess game [migrated]

I am having trouble identifying the error in my negamax implementation. It is not properly assigning the correct score except for ply 0 where it works. Obvious "pawn capture Rook" opportunities are ...
0
votes
1answer
25 views

Best approach to implement an update operation of a container object?

I have an Invoice object wich may contain several FacturedServices objects stord as a list. In may interface, the user can edit an Invoice object, delete add or edit its FacturedServices list. Whe ...
0
votes
0answers
72 views

Dealing with several custom getters

I have a data structure with data units containing different types of data. I've wrapped the data in "Field" objects so that each field is able to independently parse user input in a desired way. ...
-2
votes
0answers
31 views

A library to be able to reproduce mp3 files in Raspberry Pi [closed]

I've been having a hard time looking for a simple library to reproduce audio files (mp3 precisely) , i've tried pyglet for python, but didn't succeed, but look, the only thing i want/need is a library ...
-1
votes
0answers
52 views

What else can kill a JVM? [closed]

When A JVM (Java process) dies unexpectedly, it can be an inside job (OutOfMemoryException, or OOME) or it could be from an external stimulus. As far as internal mechanisms go: Any uncaught ...
0
votes
2answers
113 views

When should we work on GC optimiation?

So, I've learnt about how GC works and how can I monitor it via VisualVM, but my question is about why we should ever perform GC optimization? In our web project (JSF/Spring/Hibernate) we haven't ...
-4
votes
1answer
34 views

Field being skipped on use of Scanner .next() method and spaces being left out [closed]

I have a class called Student containing certain fields and I was using the following details to enter the values in its fields: Scanner s1=new Scanner(System.in); Student[] s=new ...
-5
votes
0answers
61 views

Should I learn Java or Javascript? [closed]

I am a college graduate living in Southern California with a very basic understanding of java and programming in general. If my goal were to get my first job(or internship) as soon as possible, which ...
-5
votes
0answers
44 views

which language is best to learn [closed]

i know c,c++,html&css and basic java-script , i want to know that for which next language i should go for? i am totally confuse in ruby,java,php,asp,python,.net which should i start learning?? I ...
-1
votes
0answers
37 views

Persisting state of current execution in Java

I have specific use case, and I'm looking for opinion and suggestions on implementing this in Java as I'm fairly new to this. I have a dependency graph kind of process. The entity E in the processing ...
-2
votes
2answers
130 views

Why public access level method get overridden in java?

This question is raised with a clarification required to decide when to declare a method protected or public during class design of a package. My point is, if one needs to override a method of a ...
0
votes
0answers
26 views

Structure of Input Events [closed]

I know there are KeyListeners, MouseListeners, and AnyListeners everywhere. However, that is on the higher level. I want to know what the base of it all is. The lowest-level you can get ...
0
votes
2answers
154 views

Java card game design decision

I am making an application for a card game, with a standard 52-deck playing card. For now, I am writing a solitaire game with for learning purposes. I've had some experience making platformers and ...
4
votes
3answers
230 views

Why use arg type `class Object` instead of `Comparable[]`?

In the code below, I believe it would look more appropriate to make the method argument be of type Comparable[] instead of Object[]. The first reason it would be more appropriate is that one can be ...
0
votes
1answer
105 views

Is it possible to have a keyed dictionary stored on disk? [closed]

for example) would it be possible to be able to use the key of an item to access the item stored in a file out on disk (without searching through the whole file)? I'm looking fora general example of ...
0
votes
1answer
67 views

Matrices calculations on partial shape matching

I'm working in a shape recognition project where it is supposed for me to develop an application that receives two images: an original one and a sketch made by a user. I am supposed to detect contours ...
0
votes
2answers
141 views

Develop GUI and logic in a team the right way? [closed]

I am planning to start a small project with a friend. I will be developing the GUI using JavaFX in the MVC pattern and he will be responsible for the model/logic. My question is: how can we achieve a ...
0
votes
1answer
23 views

Using classes not designed for multiple sessions in servlet

I'm looking for a way to use a collection of Java classes in a servlet, which would provide some services to clients, but the classes were not designed with multiple sessions in mind, which seems to ...
0
votes
1answer
69 views

Can JUnit be used to test this project?

I currently have an interesting situation occurring with my code, and after hacking away at what turned out to be a dead end for the last two weeks, I'm here asking those smarter than I to educate me ...
2
votes
1answer
103 views

Is Singleton enough for a EMailUtil or there is any better implementation? [duplicate]

I am developing an application, where I have to send lots of emails for user account creations, validation, invites etc. I have implemented a static class EMailUtil which has different methods like ...
-1
votes
0answers
46 views

Java - Can't call an Array from a different method [migrated]

I've been a long time lurker, and I've come across a part of my code I cannot figure out even with the help of stackexchange. I can't seem to call an Array from another method of mine. I have a bunch ...
2
votes
1answer
52 views

Creating/updating entity save strategy

Please note: although I'm talking about Java in this question, what I'm asking about here should really be language-agnostic. I am dabbling in OR/M for the first time, and have cooked up the ...
2
votes
0answers
69 views

is there a way to tell JDBC I am about to execute a transaction? [migrated]

when setting AutoCommit to false; is this means that I have to commit after executing every sql command in my application. here is a scenario SQL1 doesn't need to be a transaction. SQL2 needs to ...
0
votes
0answers
35 views

Programmatically extending table/entity definition mappings through aspects in Spring and Hibernate

I would like to know if it is possible to use AOP to extend table/entity definitions so that I can add functionality across the board that requires persistence. Let me explain what I want to do with ...
-2
votes
0answers
48 views

What is the best way to store user uploaded Java files? [duplicate]

I am working on a website where users can upload their own Java files, and we will later compile and execute them. I will address the risks of executing users' code separately, but what would be the ...