Skip to content

Tag: java

Rhombus with letters – Java

I am new to programming and started with learning c# and now java. I came across a task creating a rhombus where the user inputs the height (odd numbers only) and the char for the rhombus. I created a for loop for the height and another loop for the characters. Here is my output: But I want the output to

Select all employees sorted by last name in ascending order

How can I implement SQL query in order to select all employees sorted by last name in ascending order in the following Java class: Answer If there is a separate column for last name then it is very much easy to achieve. If there is only one column i.e. full name , then split the string from the last white

How to track a touch on the screen

I want to write a penalty shootout application, now I have set up the background and added the ball and the goalkeeper to the map. How do I make it so that when I tap on the screen, the ball follows my touch on the screen. How to do this? How to track the touch on the screen and enter

Dynamic buttons look different than static buttons

I have a layout problem. In my XML, I have some static buttons: So this is a list of buttons and I would like to add some further buttons dynamically. This is how I do it: And this is how they look like: I am missing the spaces between the dynamic buttons. It looks like the buttons have been added

Empty CLOB instead of NULL in Oracle CLOB field

Writing null string into Oracle CLOB field using Hibernate sometimes result in an empty CLOB instead of NULL in the field. Table STEP with a mix of varchar2, number and CLOB fields once was extended with a new CLOB field. and a corresponding field was added to entity All work as expected when non-null value s…

How to get ApplicationContext in xml definition?

What is the xml equivalent of the ? P.S.: When I try to google it I got a million results about how ApplicationContext works but not how to get it in the xml definition. The project is all writen using xml definition so I need to find a way how to do it without anotations. Answer First, configure your spring

How to use DateTimeFormatter for pattern dMMyyyy

I need to parse Strings to LocalDate using DateTimeFormatter. There are 2 different cases, Strings of pattern dMMyy or ddMMyy (20320, 020320, 120320) and Strings of pattern ddMMyyyy or dMMyyyy (2032020, 02032020, 12032020). For the first case i can just use DateTimeFormatter.ofPattern(“dMMyy”) whi…