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
3answers
73 views

How do you iterate through an array and delete an element?

I have an array and I can iterate through it. I know that it is impossible to change the size of an array; however, how do I take out a certain element that I not want in the array anymore? Example: ...
-3
votes
0answers
30 views

need help understanding these instructions, using java ----polymorphism, interfaces— [on hold]

I will create a LogNode class in which it will contain a log entry and a link to the next LogNode. I a log entry that will work for all the log entry classes.(I will have 3 logEntry classes)To hold ...
0
votes
1answer
54 views

Observer pattern without state change?

My question is whether there is a similar pattern to Observer that does not imply a state change in the observed object. The following is a concrete example: I have a ConnectionFactory class which is ...
2
votes
0answers
43 views

What is the correct approach for creating an application around a library?

I have a library that defines messages. In my particular instance, it's autogenerated code from an XSD using JAXB (Java). The messages can be very complex, with some members as objects and those ...
-1
votes
2answers
38 views

Should POJOs be abstracted?

My coworker tends to have each POJO implement an interface. Like Customer would implement ICustomer, with the motivation that we can now have multiple implementations of ICustomer. One example would ...
0
votes
1answer
50 views

Is it a good idea to include extra libraries in jars?

When creating executable jars for a java project, it is possible to create jar bundle which includes all the external libraries used. It is also possible to create a jar without those external ...
-5
votes
0answers
32 views

Help with boolean values in paameters [on hold]

My code is always returning the value as if the boolean is tru even though i have it as false inn the test case my code is: public class HealthRecord { static boolean dependent; static ...
0
votes
0answers
10 views

Extracting client specific code. refactoring possibilities required [duplicate]

I am facing a Design problem. I have a set of classes which writes data in XML,JSON or HTML formates for different clients. I have a class which receives Data and a XML, JSON or HTML writer as it ...
1
vote
0answers
30 views

How is ORB distinct from an endpoint?

What, fundamentally, am I misunderstanding about how to use appclient? The Application Client Container (ACC) includes a set of Java classes, libraries, and other files that are required for ...
-4
votes
0answers
80 views

I am a 15 year old and need some advice? [on hold]

I have been learning Java for an year and I am familiar with its core concepts like classes,objects , generics , I/O , multithreading , etc. Should I learn more computing concepts like Algorithms and ...
0
votes
1answer
29 views

Restructure Service - Http - Notification communication

I am trying to restructure a project to make components reusable and clearer. Consider the following scenario: A WakefulBroadcastReceiver (in my case called SimpleWakefulReceiver) will start my ...
-4
votes
0answers
44 views

How to circumvent declaring a variable final? [on hold]

I have a method that checks for a balls position and returns true or false if it has passed a certain x valie gateX, gateX is a dynamically changing value. I am trying to delay the execution of two ...
-4
votes
0answers
47 views

how to analyze some thing by OOP concept [on hold]

I have been studying OOP for 1 month. However I still don't understand the main concepts of it. Would you please show me an example that demonstrates the core OOP concepts? I 'm Vietnamese , so my ...
1
vote
5answers
202 views

Understanding basics of object declaration in Java

Is there a case when an object is declared without a call to the constructor? as in, for example: ArrayList<Integer> grades; Or is it always the case that ArrayList<Integer> grades (as ...
8
votes
3answers
223 views

Is it a sane thing to return Streams wherever we would normally return Collections?

While developing my API that is not tied to any legacy code, I often find myself writing methods that are purely Streams pipeline terminated by collecting the results. Like this one: ...
1
vote
2answers
71 views

Why am I getting field visibility warnings in Sonar?

Some static analysis tools flag non-private fields with Variable '[nameHere]' must be private and have accessor methods. Sonar consistently presents such warnings and wants to change all ...
-1
votes
3answers
94 views

Java and C++ connection? [on hold]

Quick question about them. Are they semantic kind of way related? I am learning C++ and I want to start java too. Can I get confused when learning the two languages?
0
votes
2answers
116 views

Working with two different database types for one application

Software: Java J2EE Application hosted on Tomcat Server. UPDATE The current software is JAVA Web application containing just JSP and Servlets no frameworks or anything. Simple JSP and ...
-3
votes
0answers
20 views

How to create camel component inegrate with jetty [on hold]

I am new to camel, I want to write a component integrated with jetty, which can receive http request from remote and do some process. Any ideals? Thanks a lot
2
votes
1answer
44 views

Use of validators for simple validations

I've been working in Liferay code, and I've come across this construct a few times: List<?> list; ... if (Validator.isNotNull(list)) { //do stuff }} The source code for Validator.java ...
-4
votes
0answers
35 views

Java - help with if and Selection [on hold]

i have some work that i am working on it i study now programing and i have to do some Project this is the project ""Suppose a University has contract with the airlines agent for issuing tickets for ...
3
votes
2answers
80 views

Enums in java switch-statements and completeness

I feel like I should be able to find an answer to this, but it turns out to be harder to search than expected... so: In C#, when we do something like: enum MyEnumClass { A, B }; static String ...
-2
votes
0answers
50 views

When do .bs files are created [on hold]

I have observed that sometimes ".bs" files are created. This is observed mostly incase of Java applications. I'm suspecting it to be an issue when JVM runs out of heap memory but that's just a guess, ...
-4
votes
0answers
25 views

i want to display textfields on sameline in struts2 jsps [on hold]

i want to get these textboxes on same line ,what i have to modify in this code to get the textboxes side by side in same line
-2
votes
0answers
12 views

Database solution for multi-user uml-ish application [migrated]

I'm working on a Eclipse RCP-based application that will switch from single user local storage to multi-user database storage and are now considering what storage solution to use. It's sort of UML ...
2
votes
3answers
281 views

have we come full circle with microservices, back to very old school approaches?

In terms of software architecture and design, how do microservices "stack up" (pun intended) against middleware? I'm coming from Java, and it seems like as you move away from straight REST as an API, ...
-4
votes
1answer
53 views

Hacking software development in Java

Is there a good tutorial about hacking in Java? Is it even possible? And if yes where do i start? I am programming a website with database in hibernate using Java, Struts 2, TomCat. And wondering how ...
33
votes
10answers
11k views

Why do schools teach arrays over List? [on hold]

Most of the assignments in my school for the initial programming classes required me to use arrays. I work full time now, and I never used an array for any project that I have worked on. Even in the ...
3
votes
4answers
121 views

Why use an enum to determine node type in a parse tree?

The Sun Compiler Tree API uses an interface called Tree as the parent of all the different kinds of parse tree nodes (assignments, if-statements, class declarations, etc.). A part of this interface is ...
-1
votes
3answers
112 views

Unfamiliar Array line of code in doPost() method

The code below is a code from the doPost method of a servlet, it is incomplete though. As you can see it is the logic for getting parameters from a web page, that is the first and last name and date ...
-4
votes
0answers
26 views

Netbeans will not allow me to place a Button over-top of my background (JLabel) [on hold]

When I go to place a button onto the same spot that my JLabel is located (otherwords on top of it) my button get placed to the nearest side of the image and resizes the entire JLabel (background ...
-3
votes
0answers
49 views

How can I show that an image is selected or deselected in android? [on hold]

I am new in android programming. PLEASE WATCH THIS SHORT VIDEO TO FIND EXACTLY WHAT I NEED. WHEN THE USER CLICKS ON THE IMAGE, A BORDER AND A DARK RECTANGLE APPEARS BEHIND THE IMAGE. AND WHEN THE USER ...
-1
votes
0answers
20 views

How to find a string including non word character? [migrated]

How to find a string including non word character? Example input: l l'oreal s.a. l l' ab l search String: l output: XX l'oreal s.a. XX l' ab l Expected: XX l'oreal s.a. XX l' ab X I was trying to ...
2
votes
0answers
100 views

Is it possible to use the Android layout system in a desktop java application?

I am lazy, thus, if possible, I would like to only have to design and program a UI once. If I want to create an App for Android and as a basic Java desktop application, is there a way to reuse the UI ...
1
vote
2answers
179 views

Is public final completely (not) ok in constant enum fields?

When I make enums that hold some fields, like my Settings enum, I like to make them public final to avoid lots of ( and ) keystrokes: public enum Settings { SETTING_TEST("bool_setting1", false), ...
3
votes
4answers
474 views

Interview question - Robot in a grid

This was recently asked to someone I know in an interview with a top engineering company. A robot has to move in a grid which is in the form of a matrix. It can go to A(i,j)--> A(i+j,j) ...
-3
votes
0answers
27 views

In netbeans when i run the servlet i get the following error.Why? [closed]

org.apache.jasper.JasperException: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): ...
-4
votes
0answers
25 views

Plugin in based Java project [closed]

I want to develop plugin based java project like PHP CMS such as joomla, wordpress. Is there any java based CMS available out there. If I want to develop it on my own. What should be my approach and ...
0
votes
1answer
126 views

Program to look at the first say 5 characters of a word and return a string if that string is actually the first 5 characters of a word?

For example, say I have a string and it has the letters: RDNAL This is not an actual English word or it doesn't start an actual english word, so the program would skip this string and would avoid ...
0
votes
0answers
25 views

Why Waiting Thread Doesn't wait forever [migrated]

I found below code for replicating the join() behavior in Java. There are two possible execution path: When Main thread continues execution and enters into the synchronized block. It then has to ...
0
votes
5answers
264 views

Interview Question - Adding Method to interface that has been implemented by thousands of class [closed]

There is scenario where I have Interface X, which has been implemented with my thousands of classes. Now I want to add new method in that Interface X. So how to make the changes in minimal way to ...
-1
votes
0answers
9 views

setting the R engine hangs without error [migrated]

I'm using rJava in my java project to plot some graphs. I do that using r Scripts which are called within the java code. Further explaining, I created a java class and within that wrote separate ...
-1
votes
3answers
82 views

Complex Number help

OK so I have a programming assignment and I need to create a class that represents Complex Numbers (good so far), add them to a list(good so far), and then output whether each individual number is ...
-4
votes
0answers
130 views

Building Data abstractions for rational numbers using “type abstraction” [on hold]

1) It is taught in class that data abstraction is the methodology to create barrier between "how data values are used" and "how data values are represented". Also, an abstract data type(ADT) is some ...
0
votes
0answers
10 views

Write/Reading Files in Java [migrated]

I am working on an assignment and cannot get this method to produce the correct output to the file. I am supposed to get the mean and write it to the file. Their is the StatsDemo class and the ...
0
votes
0answers
6 views

retrieving character from string.length() , using a FOR statement [migrated]

I am implementing the Luhn algorithm using a for statement and a string. My question is, does "j" get assigned the value of the character at that location of the string(the digit), or does it get ...
8
votes
0answers
126 views

Haskell build and artifact environment similar to Maven

I used to be a Java developer for a long time, but recently, I joined a Haskell team. In the java world, if you have a large project, with several teams working on it, a common approach is to use an ...
2
votes
3answers
416 views

Can a Java Boolean be used for ternary (3-state) logic?

I'm trying to make a basic cache of a boolean value, and I did it like such: private Boolean _valueCache = null; private boolean getValue() { try { if (_valueCache == null) { // if cache ...
0
votes
2answers
86 views

What naming convention should you use for data objects solely meant for parameters

This is my pseudocode for DAL: CusOrderDTO GetCustomerOrder(DateTime OrderDate, string customerCode) CusOrderDTO orderSet = new CusOrderDTO() * query data from database, populate CusOrderDTO ...
0
votes
0answers
22 views

How do I return a string from a servlet without leaving the page? [migrated]

Here's the picuture: I have a html/jsp page with a form on it. <div id = "divAttributes"> <form id = 'fid' method = "post" action = "RunQuery"> Ird Number: ...