Click here to Skip to main content
15,892,005 members
Everything / Programming Languages / Java

Java

Java

Great Reads

by ridoy
A brief explanation of application development for Android Wear, helpful for every beginner and intermediate android developer.
by raddevus
Steps for building a device you can add to your existing garage door, which implements an atmega328, bluetooth (hc-05) and relay module which will allow you to open your garage door from any paired Android device.
by Arthur V. Ratz
In this article, we will discuss about the advanced Android application development based on the example of creating a responsive Airport schedule simulator application.
by Afzaal Ahmad Zeeshan
This post attempts to describe the general difference between overloading and overriding in Object-oriented programming languages.

Latest Articles

by VivekB5
An overview of implementing Read-through and Write-through caching in Java using NCache
by Petrov Vladimir
Smart Android Template for Data Performance with International Signals Code as a Sample
by Oliver Li 2024
Java Code Change Impact Analysis
by Yochai Timmer
A way to avoid JNI's reflection oriented programming. Wrapping Java with C++

All Articles

Sort by Title

Java 

7 Nov 2022 by Shubham Guha_1007_IMCA1
I hope you got my question - ! I expect output - [Mahendra, Singh, Dhoni, Virat, Singh, Tracktor, Mahendra] The dupli Strings are - Mahendra Singh What I have tried: package Functions; import java.util.*; import java.util.Arrays; public...
7 Nov 2022 by Richard MacCutchan
if(arr[i]==arr[j]) { The above code compares two references. To compare strings you need to use the equals method: if(arr[i].equals(arr[j])) {
7 Nov 2022 by CPallini
Replace Quote: if(arr[i]==arr[j]) { with if(arr[i].equals(arr[j])) { That's a quirk of Java, see, for instance, Comparing Strings in Java[^].
7 Nov 2022 by Mirzakhmet Syzdykov
This is correct to compare hash codes rather than pointers to String class: if (arr[i].equals(arr[j])) ...; Alternatively you can use HashSet in java.util.* due to performance issues, as your algorithm is quadratic, it can be replaced with...
24 Oct 2013 by Member 10351768
"cmd.exe", "/c", "sc", "query", "STacSV" what is meaning of this onei want this one earlly friendsplease send replyAdvance Thanks
24 Oct 2013 by Prasad Khandekar
Hello,Please have a look at this manual[^] to know more about various switches supported by cmd.exe./C options tells cmd.exe to execute the specified command and then terminate.sc is a command line program used for communicating with the Service Control Manager and services.query...
24 Oct 2013 by phil.o
Just in order your question do not stay in unanswered ones:Command Prompt[^]This is a command prompt which launches the sc.exe program, passing it two arguments: query & STacSV
13 Oct 2020 by UT7
Hello everyone, please I need your help with installing javacc (java complier complier). I downloaded the latest version (7.0.9) from JavaCC | The most popular parser generator for use with Java applications.[^] unzipped it, copied the files to...
13 Oct 2020 by Sandeep Mewara
You might be missing reference of JavaCC in system path variable. Quote: The download should have placed into your file system either a ZIP or GZIP file containing the JavaCC software. You should go to the directory where the archive was...
13 Oct 2020 by Richard MacCutchan
I have got it working and the only thing I can think, is that you may have missed a step in the installation: Then place the binary javacc-7.0.9.jar in a new target/ folder, and rename to javacc.jar. If you did this then make sure that the...
21 Sep 2022 by KHOO ZHENG XIANG
//Menu (main part) import java.util.Scanner; public class ProductMain() { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Product [] productList = {new Product("1. Hot Coffees",""), ...
21 Sep 2022 by OriginalGriff
Start by fixing your indentation: at the moment it's all over the place, which makes it very difficult to work out what you expect to be going on. Chances are that that will reveal the problem anyway, but if it doesn't then back it up, and start...
21 Sep 2022 by CPallini
Quote: public class ProductMain() { Round braces are used to define methods. There you are supposed to define a class. Replace the above line with public class ProductMain {
16 Nov 2017 by CPallini
There many typos, however, I fixed them for you: /*-> this is Java, not C++ package iostream; import namespace; public class iostream { } using namespace std; int main() { //Variables int month; int year; bool leapYear = false; //
31 May 2010 by Kristian Sixhøj
Are you kidding? Do your own homework. It won't really help you much if someone does your homework for you - you're not gonna learn anything that way. But don't worry, NO ONE here is gonna do your homework for you anyway..This is really an easy thing to do, and I'm sure there's a lot of help...
5 Apr 2018 by Samira Radwan
Hi all, In my app, I have added a new directory to assets. This directory has one binary (.bin)file. I'm trying to read this file using InputStream with no success. I can see the file name I even can compare the name to an existing string, but I can't open it. Please advise. What I have...
5 Apr 2018 by David Crow
I suspect you want something like: InputStream stream = manager.open("firmware/" + file);
5 May 2015 by Jitendra_Jain04
IBM WebSphere Application Server V8.5 Liberty profile is a flexible and dynamic server profile of WAS which enables the WAS server to deploy only required custom features instead of deploying a big set of available JEE components.
16 May 2012 by sivakumar murugesan
sir/madam, i want the details of "public static void main" plz .........
16 May 2012 by Sandeep Mewara
Here: About 33,800,000 results (0.22 seconds) [^]First link: Understanding public static void main function[^]The main method is the first method, which the Java Virtual Machine executes. When you execute a class with the Java interpreter, the runtime system starts by calling the...
16 May 2012 by CPallini
Short answer:main is the entry point of your Java application.{public, static, void} are its details.As a developer, you should figure out why the application entry point has to be so, however:public - We should expose the application entry point, after all.static - This means we may...
7 Apr 2017 by Rion Williams
Here are some "secret" productivity tips for Visual Studio 2017
31 May 2018 by tsozgen
Hi There; I have a problem that drives me mad. I am abstracting a chess. Here is the piece: public abstract class Tas { public int Anahtar; public Renk Rengi; public int Degeri; public Tas() { this.Anahtar = Integer.MIN_VALUE; this.Rengi...
31 May 2018 by tsozgen
When I close and open the Eclipse, the error has gone. Thank you.
5 Jul 2016 by Member 12620828
package learn;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.Iterator;public class ClassList { int rollNo; String name; void toEnter(int rollNo, String name1) throws...
5 Jul 2016 by Mohibur Rashid
You have few more problems with your code. You are creating array of ClassList of ten and then you are reading num from keyboard, but you are not verifying. But the reason for your error is:when you create like thiscobjt = new ClassList[10];you are creating array of 10. But You...
5 Jul 2016 by Richard MacCutchan
// create an array of 10 references, but note that each reference is not initialised ClassList[] cobjt = new ClassList[10];// ...// what is this line for? arList is never used anywhere ArrayList arList = new ArrayList();// ...// you try to call a method on a null reference....
21 Jun 2015 by saudi-knight
So this is the error I get on Eclipse:## A fatal error has been detected by the Java Runtime Environment:## Internal Error (0xe0434352), pid=7696, tid=8632## JRE version: Java(TM) SE Runtime Environment (8.0_45-b15) (build 1.8.0_45-b15)# Java VM: Java HotSpot(TM) Client VM...
18 Nov 2011 by ramuksasi
Hi friends,anyone can explain the %metadata API in java. i referred in some of the sites but not get the clear information about the %metadata. or please give me useful sites to learn %metadata.
18 Nov 2011 by elgaabeb
Hi,I think nothing is better than oracle Java Metadata Interface specification :).Here is a link for oracle JMI specification PDF format:JMI SPECIFICATION[^]All is inside.Enjoy it!
17 Feb 2021 by Member 15074855
import java.util.Scanner; public class seatwork4 { public static void main (String [] args) { System.out.println ("Give at least 3 numbers: "); Scanner xd = new Scanner (System.in); double num1 = xd.nextDouble(); double num2 =...
17 Feb 2021 by Richard Deeming
Fix your code indentation, and then examine your if..else blocks: if (num1 > num2) { if (num1 > num2) { ... if (num2 > num3) { ... } else { ... } ...
17 Feb 2021 by Richard MacCutchan
You cannot have more than one else clause for an if statement. If you need to test for multiple conditions then you need to use else if or a switch block. And in your code you have: if (num1 > num2){ if (num1 > num2) // why are you...
17 Feb 2021 by Greg Utas
You are chaining two elses together: if(condition) { do A } else { do B } else // How can the code expect to get here? It makes no sense! { do C } I haven't studied your code beyond that, to see what you're trying to do, but it could...
17 Feb 2021 by OriginalGriff
You need to start sorting these syntax errors for yourself - you really didn't spend any significant time trying to fix this, given the time different between this and your previous syntax error ridden question / answers. Syntax errors are part...
17 Feb 2021 by Patrice T
Not the 'else' error, but: if (num2 > num1) { if (num2 > num3) { largest = num2; } if (num1 > num3); // the semicolon here is an error { middle = num1; smallest = num3; } else { middle =...
14 Feb 2010 by mitboyz
Can someone give an example of 'final' keyword?
13 Feb 2010 by thatraja
on a class, it prevents sub classingon a field, it prevents instantiation without initializing the fieldon a local variable, it declares it to be constantclass clsfinal{public static void main(String[] arrValues){ final int PI = 3.14;}}so here you can't modify the value of...
6 Jan 2016 by Hameed Khan
I'm facing error java.io.FileNotFoundException: myfile.java (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method)I already have set path in project properties->run->working directry Path working directry is...
6 Jan 2016 by CPallini
Well, the path of the working directory should beC:\Users\Hameed7475\Documents\NetBeansProjects\JavaApplication6\srcinstead.
6 Mar 2015 by S.Rajendran from Coimbatore
I have two java class files namely a. listmasteritems b. Mydbhandler. In an activity I use an edittext and a button. On button click in the device, I intend to send the text to the database. I get an error on button click (in device) stating 'Unfortunately,tommy has stopped working' when I...
7 Mar 2015 by Afzaal Ahmad Zeeshan
There are many possible reasons why this caused an error. Connection not established Error in value.. and so on. The actual problem is in your Console; or for Android development in Logcat. You should see for why the exception got raised. Then, solve that exception's cause.
13 Jul 2015 by Twinomugisha Stevens Emmanuel
here is my activity_main.xml xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="cc15_66.echomap.Main" > android:layout_width="fill_parent" android:layout_height="fill_parent" ...
24 May 2000 by Glenn S. Peffers
An article describing JavaScript code that will display a message (i.e. Please Wait...) while a Java Applet is loading. This code is designed to work in both IE and Netscape
7 Jan 2019 by Member 13983723
I'm trying to make find the difference game app, but I never made anything like that and since I'm a new to development I'm stuck well baby Steps are always needed to learn xD **I read in some documentation that i have to get each ImageView height and width separately so when i touch...
13 Jan 2019 by dansica
Hello, I have tried many ways to make the connection of 2 Arduino to an App but I still can't get it to run smoothly. Is there any experts out there that can help me out? I just want to connect one Arduino for 5 seconds and disconnects and then connect to the other Arduino continuously. My code...
25 Nov 2018 by dansica
Hello, I am unable to retrieve the data from Arduino. Is there anything wrong with my code? Thank You! Android Studio Code package com.example.a17019501.bluetootharduino; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import...
27 Jan 2013 by Member 9473758
I want to open my context menu via menu options but I do not know what to declare in the view area, anyhelp would be appreciated.public boolean onOptionsItemSelected(MenuItem item) { Intent serverIntent = null; switch (item.getItemId()) { case...
5 May 2013 by evanharijanto
hello everyone, I'd like to ask why is this error occurs.I am trying to get a string data from a device. I have make this code and it runs well when I try to obtain data from a local server, but it stated this error when it connects to the device.java.net.PortUnreachableException: ICMP...
3 Jul 2012 by andrusha007
I have N quantity of "clients", and each one has to implement a web service for my .Net app to consume. I dont want to add a service reference for each client because they can change at any moment, as well as the URLs, so I store the URLs on a database and dinamycally create the endpoint...
4 Jul 2012 by hutabarat
Hi, everyone...I have a big problem to solve my task in Java Programming, specially on J2ME.I can not find any solution until now about how to make an mobile GIS (Geographic Information System) application on Java Language (J2ME). I use Eclipse IDE but I can call spatial data...
4 Jul 2012 by TorstenH.
*.SHP are ESRI Shape Files[^]. Simple said: These are vector based maps.I would take a look here: OpenMap API[^]And if possible - I can recommend to use a high level API like the one from Luciad Maps[^] which gives you a kick start. But that one has to be paid.
17 Feb 2013 by unscathed18
I was wondering what kind of stuff or what should I learn in order to get my applications working online to make java server and work with html,css,javascript and databases.I've heard that the deal is working with JSP or something like that.I don't know exactly how it works, how should I...
17 Feb 2013 by Richard MacCutchan
I would recommend some of these tutorials[^], which will give you a reasonable grasp of Java; if you know C++ then it will not take long. There are also plenty of links to the other Java technologies.
17 Feb 2013 by H.Brydon
This question is asked many times about C or C++, and the wealth of books on those languages almost makes it too hard to answer.With Java however, the one book I would recommend is "Thinking in Java" by Bruce Eckel. It covers the language very well for a person that understands the basics...
3 Mar 2014 by Archemendo
I implemented some rules like;- Check the id if it is in convenient date, then add related group for example aaaa- In action rule check that if item is in related group add message or remove messageBut i think it is not convenient for rule engine to use some tables to add new groups...
4 Nov 2017 by Member 13502303
The programm should take the (final) number x and calculate the square root of it. It shall stop after n iterations. Furthermore it shall be solved with recursion. My code so far: public class Babylon{ double sqrt( final double x, final int n ) { double s; if ( n == 0...
4 Nov 2017 by Patrice T
I don't know what you try to do, but: x/x is 1, and (x+x/x) is x+1 Guessing you want to use the Babylonian method, you need to keep track of the square root you search and its current estimate. Methods of computing square roots - Wikipedia[^] There is a tool that allow you to see what your code...
4 Nov 2017 by Kenneth Haugland
You need to do something like this: double sqrt(double S, double x, double n) { if (n == 0) return x; else return sqrt(S,0.5*(x+S/x), n - 1); } S will never change since its the number you want...
16 Mar 2021 by Adam King 2021
I'm trying to make a program (in Java) that, upon pressing a key, highlights the text under your cursor, copies it, pastes it into a new tab, and searches, all using the java.awt.Robot package. It works fine the first time, but when I press the...
31 Oct 2019 by chandra liquidzey rapier
Hey guys this might be too basic, but i really find it hard to understand about return in function(i kinda understand it in a way, but for some cases its confusing), lets say i make a function to to generate a 2D array with randomized elements, and then i need to print and use that function in...
31 Oct 2019 by OriginalGriff
YOu've defined the function map as returning an integer value - so that is all it can pass back to the caller when it finishes. If you want it to return more data, you need to change the way it's declared and return a different datatype. Think of like this: you go to the cinema and then want...
23 Nov 2010 by Smaini Nurbs
What does the word 'this' in java means? Thanks in advance.Example; mSensorManager.unregisterListener(this);
23 Nov 2010 by HimanshuJoshi
This is a reference to the current object. For more info check here[^]
23 Nov 2010 by RaviRanjanKr
This Keyword is always refer to current instances of classes or you can say current object.you can use this in any way as given belowa) you can use this to overcome to instance variable hiding.b) you can use this to refer current object inside any method.c) you can use this to pass...
23 Nov 2010 by Smaini Nurbs
So in this case, which of the four options is the word 'this' being used as?a) you can use this to overcome to instance variable hiding.b) you can use this to refer current object inside any method.c) you can use this to pass object as a parameter to another methods.d) you can use this...
5 Oct 2014 by Prilvesh K
(Wildcard entry)Android Text to speech synthesis with Listview arrays with toast
20 May 2016 by CHill60
This was answered on your previous post **Not sure what programming language should I choose? **[^] and you accepted the answer!As I said there - use the reviews from Amazon to judge what people think of the books available.I also gave you a list of free websites to choose from and...
19 May 2016 by ZcrossGames
Guys!!!I really need your answers...So i tried a lot in c and c++ But i had to advantage of those thing.then i found Java And Python...Those are fine but now i am having problem to choose from them .......so i made my mind and choose Python.but i can't find any good sites to learn free....And...
19 May 2016 by CHill60
As phil.o says this post "will more likely attract personal opinions rather than verified facts""Good" is a subjective word, so you will have to decide which sites are good for you from this list[^]As for books, I would use the User Feedback on a site such as Amazon.com: Books[^] to...
4 Dec 2021 by OriginalGriff
Quote: dont know where to start, too hard, please use dp programing to solve While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting...
4 Dec 2021 by Richard MacCutchan
Start here: Java Tutorials Learning Paths[^].
17 Aug 2020 by Member 14916385
Hello guys how can i am just beginner in java and i feel that i can't make a project and practice what i learned so what is the way that i can through mastering java and create my onw projects and please guide me and show me some refrences can...
17 Aug 2020 by CHill60
First - Practice, Practice, Practice. Also - Do some research. Have a look at the resources on Codeproject https://www.codeproject.com/KB/java/[^] Try some of exercises posted on line - try this list[^]
17 Aug 2020 by Patrice T
Quote: please guide me and show me some refrences can help me My guess is that you are learning programming. You have to know that you can do pretty much anything in any language, simply some languages are harder for beginners because there is...
17 Aug 2020 by OriginalGriff
There are several ways to learn any computer langauge, and in order of effectiveness: 1) Go on a course. Absolutely the best way to learn - if you don't understand, you can ask, and it can be rephrased until you do. Additionally, your exercises...
17 Aug 2020 by Richard MacCutchan
See The Java™ Tutorials[^].
30 Apr 2016 by Member 12495450
You are given a string as an input. Rearrange the characters of the string such that no character appears in its original position.If the rearrangement is possible, print the rearranged string else print 'Not possible'.Sample Input:Case 1:aabccbadd Case 2:abaab Sample...
30 Apr 2016 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search using the beginning of your subject as the search term gave half a million hits: Rearrange the characters of the string such that no character appears...
23 Mar 2016 by Patrice T
This is not a good question, I fear no help is possible from our side.Problem: you state a vague problem and dump a piece of code without explanation.Asking questions is a skill[^]What you haven't done/said:- reduce the size of code.- is it always on same pictures ?- the picture...
23 Sep 2013 by Member 10292973
Hi! This program is supposed to write to a file, then read it. It's reading randomized coordinates generated by the program. Whenever I compile the program it gives me the error of:File: F:\COMPSCI 12\J4.java [line: 54]Error: F:\COMPSCI 12\J4.java:54: '.class' expectedI'm not sure...
13 Jan 2016 by sibyEntero
I am developing a Java application in Swing.My application needs the win32com.dll (Java Communication API) and the file javax.comm.properties.Normally, I just copy the dll to C:\Java\jre1.6\bin and the config file to C:\Java\jre1.6\lib.The Code I written was...
13 Jan 2016 by Richard MacCutchan
The message:Exception in thread "main" java.lang.UnsatisfiedLinkError: no win32com.dll in java.library.pathis quite clear. The loader cannot find the dll anywhere.
12 May 2022 by rudraSahu7786
I made a Java Project which fetches data from SQLite.db which I included in my project folder. After creating Jar file I converted it to exe file using an app. Now when i am running my exe file. It is not able to fetch data from database. Please...
18 Jan 2022 by vinoth raja 2022
Implement the Java classes (with full details of all felds and methods, including constructors and getter, setter methods) which are required to simulate the following problem: A casino has 10 Fruit Machines that customers are using to play. A...
18 Jan 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
18 Jan 2022 by Richard MacCutchan
You can learn Java at Java Tutorials Learning Paths[^]
26 Oct 2020 by Matteo Prosperi
In this article, we investigate how DateTime issues are avoided.
23 Aug 2012 by Gokul Anand
hi Alli want to execute remote commands on a remote machine and get back its outputexample: ipconfigand getting its output back on the local computerI want to do this using Java or .Netthanks
24 Aug 2012 by TorstenH.
Have fun!Tell us when you've decided to use a certain language.In the meantime -> www.google.com should show you first ideas.
20 Sep 2011 by Shalfey89
Hello, everyone. I need an advice.I've recently got a bachelor degree in Computer Science. I've got some experience in C++, but it seems rather difficult to go on moving in this direction. The language is pretty difficult. It becomes more and more difficult to find a job for a juniors in the...
21 Sep 2011 by Nagy Vilmos
If you can do one you can pick up the other easily enough. The most valuable skill is not the language you use to implement a solution, but the ability to choose the right approach.You may find that today Java is paying more than .NET. What about tomorrow?I have been around the block a...
5 May 2009 by Vitaly Shelest
Describes an SDK that enables direct Java calls to export functions from regular DLL modules
19 Aug 2013 by TapasU
Hi All,I am making call to a Java service from my ASMX. However, I am getting the following exception from the Java call in my .Net code base.System.Web.Services.Protocols.SoapException : System.Web.Services.Protocols.SoapException: Server was unable to process request. --->...
19 Aug 2013 by TapasU
Hi All,I tried SOAPUI tool to generate the request. But I am getting Following Error.HTTP/1.1 400 Bad RequestDate: Tue, 20 Aug 2013 05:41:30 GMTServer: Microsoft-IIS/6.0X-Powered-By: ASP.NETCache-Control: privateContent-Length: 0Sample Request below
22 Sep 2011 by ahsanriaz1K
Hi,1)Why .Net is not preffered over java other than open source reason?2)Who is most powerful, java or .net?3)What features .net has in comparison to java?Please answer these.. as i want a detailed answer about these.
22 Sep 2011 by Richard MacCutchan
1. It is preferred - by some; the answer is a matter of opinion not fact.2. It depends, today Java, tomorrow .NET.3. Go and do some research into this as there will be lots of differences and similarities.
22 Sep 2011 by André Kraak
Start by reading this http://en.wikipedia.org/wiki/Comparison_of_the_Java_and_.NET_platforms[^].