Tag: c

57 votes
30 answers
2.3K views
How do you disable browser autocomplete on web form field / input tags?

How do you disable autocomplete in the major browsers for a specific input (or form field)?

avatar
Mikki
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
675 views
Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding

avatar
Patsy
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
2.6K views
Change a HTML5 input&apos;s placeholder color with CSS

Chrome supports the placeholder attribute on input[type=text] elements (others probably do too). But the follo

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
65 votes
30 answers
1.9K views
How to horizontally center an element

How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <

avatar
Sachiko
0 1 0 9
asked 07 September, 2021
56 votes
10 answers
840 views
Why does HTML think “chucknorris” is a color?

Why do certain random strings produce colors when entered as background colors in HTML? For example: <b

avatar
Majorie
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
519 views
How can I convert a stack trace to a string?

What is the easiest way to convert the result of Throwable.getStackTrace() to a string that depicts the stackt

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
1.9K views
What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message

avatar
Xavier
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.8K views
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have

avatar
Trudy
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
1.3K views
Why use getters and setters/accessors?

What's the advantage of using getters and setters - that only get and set - instead of simply using publi

avatar
Shantay
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
836 views
How can I avoid Java code in JSP files, using JSP 2?

I'm new to Java EE and I know that something like the following three lines <%= x+1 %> <%= reque

avatar
Solomon
0 1 0 9
asked 07 September, 2021
51 votes
30 answers
705 views
Sort a Map<Key, Value> by values

I am relatively new to Java, and often find that I need to sort a Map<Key, Value> on the values. Since

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.2K views
How to generate a random alpha-numeric string

I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my si

avatar
Arline
0 1 0 9
asked 07 September, 2021
57 votes
27 answers
1.4K views
Java inner class and static nested class

What is the main difference between an inner class and a static nested class in Java? Does design / implementa

avatar
Stacia
0 1 0 9
asked 07 September, 2021
66 votes
11 answers
911 views
How to use java.net.URLConnection to fire and handle HTTP requests

Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is too concise about i

avatar
Vi
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
1.7K views
How do you assert that a certain exception is thrown in JUnit 4 tests?

How can I use JUnit4 idiomatically to test that some code throws an exception? While I can certainly do somet

avatar
Hallie
0 1 0 9
asked 07 September, 2021
54 votes
29 answers
2.6K views
What&apos;s the difference between @Component, @Repository & @Service annotations in Spring?

Can @Component, @Repository and @Service annotations be used interchangeably in Spring or do they provide any

avatar
Tana
0 1 0 9
asked 07 September, 2021
53 votes
22 answers
1.2K views
What is reflection and why is it useful?

What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principle

avatar
Shanita
0 1 0 9
asked 07 September, 2021
54 votes
23 answers
2.1K views
How do I call one constructor from another in Java?

Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? An

avatar
Yolando
0 1 0 9
asked 07 September, 2021
47 votes
30 answers
757 views
Does a finally block always get executed in Java?

Considering this code, can I be absolutely sure that the finally block always executes, no matter what somethi

avatar
Rudy
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
889 views
How can I create an executable JAR with dependencies using Maven?

I want to package my project in a single executable JAR for distribution. How can I make a Maven project pack

avatar
Xavier
0 1 0 9
asked 07 September, 2021