Skip to content

Tag: java

Unable to retrieve data from database through JDBC query

I trying to make a connection to my DDBB in order to print all the columns from a table but I keep getting Null. I have checked the connection parameters and everything seems correct. I’m thinking that maybe there is something wrong with my query statement: Answer I managed to solve the problem by addin…

Returning a subset that has a duplicate

My question is how to detect the duplicate on one subset of array that does not exist in the other substring? For example Input: arr1 = 1,2,3 arr2 = 1,1 Output: Arr2 is not a subset of Arr1 So far everything else works fine and how I want it to but this duplicate one keeps returning that it is a

Java Substring based on condtion

I’m pretty new to Java and I would like to know if there is an effective way of creating a substring based on conditions. Currently I am reading from a txt file and changing that txt file to a String format using BufferedReader. I am receiving several txt files but they all have the same format. The dat…

Pass calculated values by inherited classes to main class

So in my main function I got a class named Figure Circle and Rectangle extend class Figure. Square extends class Rectangle. Now I have to print the values from created objects. I think I am approaching this in wrong way. How can I pass the values to the print function that have been created by other classes? …

How to get indexes of char in the string

I want to find vowels positions in the string. How can I make shorter this code? I tried contains and indexOf method but couldn’t do it. Answer I assume you want to get m2rh5b7 from your input string Merhaba based on your code, then the below works fine, Or if you want just position of the vowels positi…